|
|
@@ -67,15 +67,15 @@ module.exports = function(crowi, app) {
|
|
|
const trustProxyCsv = configManager.getConfig('crowi', 'security:trustProxyCsv');
|
|
|
const trustProxyHops = configManager.getConfig('crowi', 'security:trustProxyHops');
|
|
|
|
|
|
- const isNotSpec = [trustProxyBool, trustProxyCsv, trustProxyHops].filter(trustProxy => trustProxy != null).length !== 1;
|
|
|
+ const trustProxy = trustProxyBool ?? trustProxyCsv ?? trustProxyHops;
|
|
|
|
|
|
try {
|
|
|
- const trustProxy = trustProxyBool ?? trustProxyCsv ?? trustProxyHops;
|
|
|
- if (isNotSpec) {
|
|
|
- // eslint-disable-next-line max-len
|
|
|
- logger.warn(`If more than one TRUST_PROXY_ ~ environment variable is set, the values are set in the following order of inequality size (BOOL > CSV > HOPS) first. Set value: ${trustProxy}`);
|
|
|
- }
|
|
|
if (trustProxy != null) {
|
|
|
+ const isNotSpec = [trustProxyBool, trustProxyCsv, trustProxyHops].filter(trustProxy => trustProxy != null).length !== 1;
|
|
|
+ if (isNotSpec) {
|
|
|
+ // eslint-disable-next-line max-len
|
|
|
+ logger.warn(`If more than one TRUST_PROXY_ ~ environment variable is set, the values are set in the following order of inequality size (BOOL > CSV > HOPS) first. Set value: ${trustProxy}`);
|
|
|
+ }
|
|
|
app.set('trust proxy', trustProxy);
|
|
|
}
|
|
|
}
|