Skip to content

Instantly share code, notes, and snippets.

@KasperTidemann
Created March 8, 2013 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KasperTidemann/196ae5c52d02067d2267 to your computer and use it in GitHub Desktop.
Save KasperTidemann/196ae5c52d02067d2267 to your computer and use it in GitHub Desktop.
app.use(function (req, res, next) {
// see above
res.setHeader('Strict-Transport-Security', 'max-age=8640000; includeSubDomains');
if (req.headers['x-forwarded-proto'] !== 'https') {
return res.redirect(301, 'https://' + req.headers.host + '/');
}
next();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment