mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
try force-ssl again
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user