Created
November 13, 2013 11:28
-
-
Save strikeout/7447575 to your computer and use it in GitHub Desktop.
Attach Meteor HTTP Headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* HTTP Header Security | |
* | |
* enforce HTTP Strict Transport Security (HSTS) to prevent ManInTheMiddle-attacks | |
* on supported browsers (all, but IE) | |
* > http://www.html5rocks.com/en/tutorials/security/transport-layer-security | |
* | |
* @header Strict-Transport-Security: max-age=2592000; includeSubDomains | |
*/ | |
var connectHandler = WebApp.connectHandlers; // get meteor-core's connect-implementation | |
// attach connect-style middleware for response header injection | |
Meteor.startup(function () { | |
connectHandler.use(function (req, res, next) { | |
res.setHeader('Strict-Transport-Security', 'max-age=2592000; includeSubDomains'); // 2592000s / 30 days | |
return next(); | |
}) | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment