try force-ssl again

This commit is contained in:
Tyler Renelle
2012-10-12 08:11:49 -04:00
parent 489e61c4e4
commit a37fba5524
2 changed files with 19 additions and 5 deletions

View File

@@ -36,6 +36,18 @@ server = http.createServer(expressApp);
module.exports = server;
Set(before(other(routes, as(early(as(possible))))));
if (process.env.NODE_ENV === 'production') {
expressApp.get('*', function(req, res, next) {
if (req.headers['x-forwarded-proto'] !== 'https') {
return res.redirect('https://' + req.headers.host + req.url);
} else {
return next();
}
});
}
derby.use(require('racer-db-mongo'));
store = derby.createStore({