From 358bf873296d4d4e84611d3f3d5ae48eabfc8ad6 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sat, 10 Jul 2021 19:02:32 +0200 Subject: :zap: cache assets --- src/routes/attachments.ts | 1 + src/routes/avatars.ts | 1 + 2 files changed, 2 insertions(+) (limited to 'src/routes') diff --git a/src/routes/attachments.ts b/src/routes/attachments.ts index 2e635b43..acc7604d 100644 --- a/src/routes/attachments.ts +++ b/src/routes/attachments.ts @@ -52,6 +52,7 @@ router.get("/:channel_id/:id/:filename", async (req: Request, res: Response) => const type = await FileType.fromBuffer(file); res.set("Content-Type", type?.mime); + res.set("Cache-Control", "public, max-age=31536000"); return res.send(file); }); diff --git a/src/routes/avatars.ts b/src/routes/avatars.ts index 321ae02e..fea7c5f4 100644 --- a/src/routes/avatars.ts +++ b/src/routes/avatars.ts @@ -52,6 +52,7 @@ router.get("/:user_id/:id", async (req: Request, res: Response) => { const type = await FileType.fromBuffer(file); res.set("Content-Type", type?.mime); + res.set("Cache-Control", "public, max-age=31536000"); return res.send(file); }); -- cgit 1.5.1