Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
node express based app: redirect http to https
...
app.all('*', function(req, res, next){
console.log('req start: ',req.secure, req.hostname, req.url, app.get('port'));
if (req.secure) {
return next();
}
res.redirect('https://'+req.hostname + ':' + app.get('secPort') + req.url);
});
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.