Skip to content

Instantly share code, notes, and snippets.

@oroce
Created June 17, 2014 08:37
Show Gist options
  • Save oroce/361d1abda643d1b6a95d to your computer and use it in GitHub Desktop.
Save oroce/361d1abda643d1b6a95d to your computer and use it in GitHub Desktop.
parse csp report in express
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
// chrome sends application/csp-report
// firefox sends application/json
// it seems chrome is doing it well: https://w3c.github.io/webappsec/specs/content-security-policy/
app.use(bodyParser.json({
type: ['json', 'application/csp-report']
}));
Copy link

ghost commented Dec 31, 2015

thank you 👍

@cellis
Copy link

cellis commented Oct 18, 2016

🍾

@kryz81
Copy link

kryz81 commented Feb 10, 2017

👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment