diff --git a/packages/core/src/env/consts.ts b/packages/core/src/env/consts.ts index 642778e75..87f63dc2e 100644 --- a/packages/core/src/env/consts.ts +++ b/packages/core/src/env/consts.ts @@ -5,3 +5,6 @@ export const isProduction = getEnv('NODE_ENV') === 'production'; export const port = Number(getEnv('PORT', '3001')); export const mountedApps = Object.freeze(['api', 'oidc']); export const developmentUserId = getEnv('DEVELOPMENT_USER_ID'); + +// Trusting TLS offloading proxies: https://github.com/panva/node-oidc-provider/blob/main/docs/README.md#trusting-tls-offloading-proxies +export const trustingTlsOffloadingProxies = getEnv('TRUSTING_TLS_OFFLOADING_PROXIES') === 'true'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 6bf702547..e462da36c 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -7,9 +7,12 @@ import Koa from 'koa'; dotenv.config(); import initApp from './app/init'; +import { trustingTlsOffloadingProxies } from './env/consts'; import initI18n from './i18n/init'; -const app = new Koa(); +const app = new Koa({ + proxy: trustingTlsOffloadingProxies, +}); (async () => { try {