diff --git a/server/routes/index.js b/server/routes/index.js index 4245b10d08..bcdb9f9c28 100644 --- a/server/routes/index.js +++ b/server/routes/index.js @@ -104,11 +104,16 @@ if (true || process.env.NODE_ENV === "production") { res.setHeader("Cache-Control", `max-age=${365 * 24 * 60 * 60}`); }, }); - } catch { - // Serve a bad request instead of not found if the file doesn't exist - // This prevents CDN's from caching the response, allowing them to continue - // serving old file versions - ctx.status = 400; + } catch (err) { + if (err.status === 404) { + // Serve a bad request instead of not found if the file doesn't exist + // This prevents CDN's from caching the response, allowing them to continue + // serving old file versions + ctx.status = 400; + return; + } + + throw err; } }); }