Created
September 17, 2019 00:50
-
-
Save carlohcs/bac9405075cd8906188b8a887efdc0f9 to your computer and use it in GitHub Desktop.
Força o redirect para HTTPS no Heroku
This file contains hidden or 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
function forceSSL(req, res, next) { | |
if (req.headers['x-forwarded-proto'] !== 'https') { | |
// console.log('FORCING SSL. Redirecting... ', [BASE_URL, req.url].join('')) | |
return res.redirect(301, [BASE_URL, req.url].join('')) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment