-
-
Save barbagrigia/162933f5cdddfd78d542c34021ce4278 to your computer and use it in GitHub Desktop.
Make node.js express respect x-forwarded-proto on res.redirect
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
app.configure(function(){ | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
// use this to let express know it is on a encrypted connection | |
app.use(function(req, res, next) { | |
var schema = req.headers["x-forwarded-proto"]; | |
if (schema === "https") { | |
req.connection.encrypted = true; | |
} | |
next(); | |
}); | |
app.use(express.bodyParser()); | |
app.use(express.methodOverride()); | |
app.use(app.router); | |
app.use(express.static(__dirname + '/public')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment