diff --git a/src/lib/app.ts b/src/lib/app.ts index 93a0399b9..0fb01c2a1 100644 --- a/src/lib/app.ts +++ b/src/lib/app.ts @@ -63,6 +63,13 @@ if (config.useSSL) { server = http.createServer(app) } +// if we manage to provide HTTPS domains, but don't provide TLS ourselves +// obviously a proxy is involded. In order to make sure express is aware of +// this, we provide the option to trust proxies here. +if (!config.useSSL && config.protocolUseSSL) { + app.set('trust proxy', 1) +} + // socket io const io = SocketIO(server, { cookie: false }) io.engine.ws = new WebSocket.Server({