npm/blankie

Name: blankie

Owner: npm

Description: a hapi CSP plugin

Forked from: nlf/blankie

Created: 2016-02-18 18:55:09.0

Updated: 2018-01-22 18:46:51.0

Pushed: 2016-02-22 16:44:24.0

Homepage: null

Size: 26

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

blankie

A CSP plugin for hapi.

Usage

This plugin depends on scooter to function.

To use it:

Hapi = require('hapi');
Blankie = require('blankie');
Scooter = require('scooter');

server = new Hapi.Server();

er.register([Scooter, {
register: Blankie,
options: {} // specify options here
function (err) {

if (err) {
    throw err;
}

server.start();

Options may also be set on a per-route basis:

Hapi = require('hapi');
Blankie = require('blankie');
Scooter = require('scooter');

server = new Hapi.Server();

er.route({
method: 'GET',
path: '/something',
config: {
    handler: function (request, reply) {

        reply('these settings are changed');
    },
    plugins: {
        blankie: {
            scriptSrc: 'self'
        }
    }
}

Note that this setting will NOT be merged with your server-wide settings.

You may also set config.plugins.blankie equal to false on a route to disable CSP headers completely for that route.

Options

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.