Skip to content

Instantly share code, notes, and snippets.

@SindreSvendby
Last active September 9, 2015 08:14
Show Gist options
  • Save SindreSvendby/7520d03459752a312ae1 to your computer and use it in GitHub Desktop.
Save SindreSvendby/7520d03459752a312ae1 to your computer and use it in GitHub Desktop.
// Dumps all headers
// My usages is to test what headers Cloudfront is setting. Used together with ngrok for me.
//start script:
// npm install
// node headers.js
var express = require('express');
var app = express();
app.get('/', function (req, res) {
console.log(req.headers);
res.send('Headers captured. Check log!');
});
var server = app.listen(process.env.PORT || 3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
{
"name": "headers-dump",
"version": "1.0.0",
"description": "Dump all req.headers to console",
"main": "headers.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"headers"
],
"author": "Sindre Øye Svendby",
"license": "ISC",
"dependencies": {
"express": "^4.13.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment