Created
August 13, 2012 02:36
-
-
Save koush/3336498 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
Awesome!