From 6d5a6fd71ae8be2ba65cdb415b968b99692fcf69 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Mon, 13 Feb 2023 17:50:08 +0100 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20proxy=20custom=20service=20work?= =?UTF-8?q?er=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/routes/index.ts | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/server/routes/index.ts b/server/routes/index.ts index 06736b66f1..6daa6154c8 100644 --- a/server/routes/index.ts +++ b/server/routes/index.ts @@ -23,30 +23,27 @@ const router = new Router(); koa.use(userAgent); // serve public assets -router.use( - ["/images/*", "/email/*", "/sw.js", "/registerSW.js"], - async (ctx, next) => { - let done; +router.use(["/images/*", "/email/*"], async (ctx, next) => { + let done; - if (ctx.method === "HEAD" || ctx.method === "GET") { - try { - done = await send(ctx, ctx.path, { - root: path.resolve(__dirname, "../../../public"), - // 7 day expiry, these assets are mostly static but do not contain a hash - maxAge: 7 * 24 * 60 * 60 * 1000, - }); - } catch (err) { - if (err.status !== 404) { - throw err; - } + if (ctx.method === "HEAD" || ctx.method === "GET") { + try { + done = await send(ctx, ctx.path, { + root: path.resolve(__dirname, "../../../public"), + // 7 day expiry, these assets are mostly static but do not contain a hash + maxAge: 7 * 24 * 60 * 60 * 1000, + }); + } catch (err) { + if (err.status !== 404) { + throw err; } } - - if (!done) { - await next(); - } } -); + + if (!done) { + await next(); + } +}); router.use( ["/share/:shareId", "/share/:shareId/doc/:documentSlug", "/share/:shareId/*"],