From 2503bfd3a2fa2d8a5b920195c0fb314615d1e944 Mon Sep 17 00:00:00 2001 From: Philip Okugbe <16838612+Philipinho@users.noreply.github.com> Date: Sat, 14 Dec 2024 19:55:49 +0000 Subject: [PATCH] fix: prevent CDNs from caching attachments (#562) --- apps/server/src/core/attachment/attachment.controller.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/server/src/core/attachment/attachment.controller.ts b/apps/server/src/core/attachment/attachment.controller.ts index 0227f597..4804fce6 100644 --- a/apps/server/src/core/attachment/attachment.controller.ts +++ b/apps/server/src/core/attachment/attachment.controller.ts @@ -178,7 +178,7 @@ export class AttachmentController { const fileStream = await this.storageService.read(attachment.filePath); res.headers({ 'Content-Type': attachment.mimeType, - 'Cache-Control': 'public, max-age=3600', + 'Cache-Control': 'private, max-age=3600', }); if (!inlineFileExtensions.includes(attachment.fileExt)) { @@ -299,7 +299,7 @@ export class AttachmentController { const fileStream = await this.storageService.read(filePath); res.headers({ 'Content-Type': getMimeType(filePath), - 'Cache-Control': 'public, max-age=86400', + 'Cache-Control': 'private, max-age=86400', }); return res.send(fileStream); } catch (err) {