Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Created May 16, 2016 12:57
Show Gist options
  • Save andrewjmead/768a1573672743c073786e8bb376ac5a to your computer and use it in GitHub Desktop.
Save andrewjmead/768a1573672743c073786e8bb376ac5a to your computer and use it in GitHub Desktop.
Redirect To HTTP Always
// ...
app.use(function (req, res, next){
if (req.headers['x-forwarded-proto'] === 'https') {
res.redirect('http://' + req.hostname + req.url);
} else {
next();
}
});
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment