From ff9283f5612fc9192921ba32197f4bca48c45ce2 Mon Sep 17 00:00:00 2001 From: Victor Perron Date: Fri, 19 Jun 2015 11:41:10 +0200 Subject: [PATCH] Enable use behind a proxy The issue has been around for quite some time now. The fix seems to work for rlidwka/sinopia#232 . --- lib/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/index.js b/lib/index.js index 8e9c8ecc..238465fb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -19,6 +19,11 @@ module.exports = function(config_hash) { // run in production mode by default, just in case // it shouldn't make any difference anyway app.set('env', process.env.NODE_ENV || 'production') + + // for nginx proxy + if (process.env.VIRTUAL_HOST) { + app.enable('trust proxy'); + } function error_reporting_middleware(req, res, next) { res.report_error = res.report_error || function(err) {