Skip to content

Instantly share code, notes, and snippets.

Created July 19, 2017 21:23
Show Gist options
  • Save anonymous/a478c6ce28f979c37ea2538f8e591d0b to your computer and use it in GitHub Desktop.
Save anonymous/a478c6ce28f979c37ea2538f8e591d0b to your computer and use it in GitHub Desktop.
Node.js: Heroku-modified HTTPS solution
app.use(function(req, res, next){
if(req.header('x-forwarded-proto') !== 'https'){
res.redirect('https://' + req.header('host') + req.url);
}else{
next();
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment