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
+7 -5
View File
@@ -24,11 +24,13 @@ server = http.createServer expressApp
module.exports = server
# Force SSL
# Set before other routes, as early as possible
# if process.env.NODE_ENV=='production'
# expressApp.all '*', (req, res, next) ->
# if req.headers['x-forwarded-proto']!='https'
# res.redirect('https://'+req.headers.host+req.url)
Set before other routes, as early as possible
if process.env.NODE_ENV=='production'
expressApp.get '*', (req, res, next) ->
if req.headers['x-forwarded-proto']!='https'
res.redirect('https://'+req.headers.host+req.url)
else
next()
derby.use(require 'racer-db-mongo')
store = derby.createStore