-
-
Save RabidFire/7f01bb6c749b3c8bd089 to your computer and use it in GitHub Desktop.
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
// My login page is getting a redirect loop. This wasn't happening on AWS though. | |
app.get('/login', forceHttps, users.login); | |
// I know for sure this function 'forceHttps' is the issue, because I changed this... | |
app.get('/privacy', routes.privacy); | |
// ... to this ... | |
app.get('/privacy', forceHttps, routes.privacy); | |
// ... and the privacy page is also having the redirect loop now. | |
// code | |
function forceHttps(req, res, next){ | |
if ('development' !== app.get('env') && !req.connection.encrypted) { | |
return res.redirect('https://' + req.headers.host + req.url); | |
} | |
return next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment