From 26f2deb234596e3d273f4550023f5238774410dd Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 9 Oct 2024 13:34:43 +0100 Subject: [PATCH] Set proxy setting on Koa application. --- packages/backend-core/src/features/features.ts | 2 ++ packages/server/src/koa.ts | 1 + packages/worker/src/index.ts | 1 + 3 files changed, 4 insertions(+) diff --git a/packages/backend-core/src/features/features.ts b/packages/backend-core/src/features/features.ts index efe6495cb5..cb095e792c 100644 --- a/packages/backend-core/src/features/features.ts +++ b/packages/backend-core/src/features/features.ts @@ -198,6 +198,8 @@ export class FlagSet, T extends { [key: string]: V }> { let userId = identity?._id if (!userId) { const ip = context.getIP() + // TODO; REMOVE THIS + tags["userIP"] = ip if (ip) { userId = crypto.createHash("sha512").update(ip).digest("hex") } diff --git a/packages/server/src/koa.ts b/packages/server/src/koa.ts index dd8063795d..acae433cc3 100644 --- a/packages/server/src/koa.ts +++ b/packages/server/src/koa.ts @@ -12,6 +12,7 @@ import { userAgent } from "koa-useragent" export default function createKoaApp() { const app = new Koa() + app.proxy = true let mbNumber = parseInt(env.HTTP_MB_LIMIT || "10") if (!mbNumber || isNaN(mbNumber)) { diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index 9c3c053baf..fb6a97a844 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -46,6 +46,7 @@ bootstrap() const app: Application = new Application() app.keys = ["secret", "key"] +app.proxy = true // set up top level koa middleware app.use(handleScimBody)