mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-06 15:42:52 +01:00
Allow setting value of Express 'trust proxy' from config (#13034)
* Allow setting value of Express 'trust proxy' from config * Allow config to disable 'trust proxy' if port is 80/443 And show the value of trust_proxy in log * fix errors
This commit is contained in:
@@ -277,9 +277,12 @@ async function listen() {
|
||||
}
|
||||
}
|
||||
port = parseInt(port, 10);
|
||||
if ((port !== 80 && port !== 443) || nconf.get('trust_proxy') === true) {
|
||||
winston.info('🤝 Enabling \'trust proxy\'');
|
||||
app.enable('trust proxy');
|
||||
|
||||
let trust_proxy = nconf.get('trust_proxy');
|
||||
if (trust_proxy == null && ![80, 443].includes(port)) trust_proxy = true;
|
||||
if (trust_proxy) {
|
||||
winston.info(`🤝 Setting 'trust proxy' to ${JSON.stringify(trust_proxy)}`);
|
||||
app.set('trust proxy', trust_proxy);
|
||||
}
|
||||
|
||||
if ((port === 80 || port === 443) && process.env.NODE_ENV !== 'development') {
|
||||
|
||||
Reference in New Issue
Block a user