Merge branch 'master' of github.com:akhoury/NodeBB into akhoury-master

Conflicts:
	src/user.js
This commit is contained in:
Julian Lam
2014-01-23 08:15:16 -05:00
8 changed files with 95 additions and 45 deletions

View File

@@ -191,6 +191,25 @@ if(nconf.get('ssl')) {
app.use(express.csrf());
// negative boolean with type check here to support a config.json without a 'use_proxy' value,
// so unless it's specifically set to false, it's true (as long as it's not a dev env)
// todo: remove double negative with a minor release, where backward compatibility can be broken
// and if dev mode, then it's probably not behind a proxy but it can be forced by setting 'use_proxy' to true
if (nconf.get('use_proxy') === false) {
winston.info('\'use_proxy\' is set to false in config file, skipping \'trust proxy\'');
} else if (!nconf.get('use_proxy') && process.env.NODE_ENV === 'development') {
winston.info('\'use_proxy\' is not set, skipping because you\'re in development env. Set to true to force enabling it.');
} else {
winston.info('\'use_proxy\''
+ (nconf.get('use_proxy') === true ? ' is set to true ' : ' is not set ')
+ 'in config file, enabling \'trust proxy\', set to false to disable it.');
app.enable('trust proxy');
}
// Local vars, other assorted setup
app.use(function (req, res, next) {
nconf.set('https', req.secure);
@@ -210,7 +229,7 @@ if(nconf.get('ssl')) {
user.setUserField(req.user.uid, 'lastonline', Date.now());
}
next();
})
});
next();
},