From 8fec6758b899b867c1479f342a8ecd5d3d8922d2 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 14 Jan 2025 19:01:51 -0500 Subject: [PATCH] fix: Move compression middleware to cover all /api and /auth routes --- server/routes/index.ts | 3 --- server/services/web.ts | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/server/routes/index.ts b/server/routes/index.ts index f41d50f43de4..417da32381a3 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -2,7 +2,6 @@ import crypto from "crypto"; import path from "path"; import { formatRFC7231 } from "date-fns"; import Koa, { BaseContext } from "koa"; -import compress from "koa-compress"; import Router from "koa-router"; import send from "koa-send"; import userAgent, { UserAgentContext } from "koa-useragent"; @@ -92,8 +91,6 @@ if (env.isProduction) { }); } -router.use(compress()); - router.get("/locales/:lng.json", async (ctx) => { const { lng } = ctx.params; diff --git a/server/services/web.ts b/server/services/web.ts index 1dd4dc399c1a..18c6d4192394 100644 --- a/server/services/web.ts +++ b/server/services/web.ts @@ -2,6 +2,7 @@ import crypto from "crypto"; import { Server } from "https"; import Koa from "koa"; +import compress from "koa-compress"; import { contentSecurityPolicy, dnsPrefetchControl, @@ -72,6 +73,7 @@ export default function init(app: Koa = new Koa(), server?: Server) { app.proxy = true; } + app.use(compress()); app.use(mount("/auth", auth)); app.use(mount("/api", api));