Neolithic Populous Metropolis

    simple-csp

    0.1.1 • Public • Published

    Very simple Content Security Policy (CSP) manager

    Usage

    var express = require( 'express' );
    var app = express();
    var csp = require( "simple-csp" );
    
    var csp_headers = {
        "default-src": ["'self'", "http://example.com"],
        "connect-src": ["'self'", "http://example.com"],
        "img-src": ["'self'", "data:", "http://example.com"]
    };
    
    app.use( "/", function ( req, res, done ) {
        csp.header( csp_headers, res );
        done();
    } );
    
    // Static files from ./public
    app.use( "/", express.static( "./public" ) );
    
    app.listen( 8888 );

    Install

    npm i simple-csp

    DownloadsWeekly Downloads

    5

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • avatar