From 89e9c60942f30a09fb72c5f43335895427900fe9 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Fri, 10 Sep 2021 11:59:21 +0200 Subject: [PATCH] fix: fix cache duration --- src/routes/file.ts | 2 +- src/routes/repository-public.ts | 4 ++-- src/server.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/file.ts b/src/routes/file.ts index bc6b4fa..002484d 100644 --- a/src/routes/file.ts +++ b/src/routes/file.ts @@ -34,7 +34,7 @@ router.get( anonymizedPath.substring(anonymizedPath.lastIndexOf("/") + 1) ); // cache the file for 5min - res.header('Cache-Control', 'max-age=250000'); + res.header('Cache-Control', 'max-age=300'); await f.send(res); } catch (error) { return handleError(error, res); diff --git a/src/routes/repository-public.ts b/src/routes/repository-public.ts index 39396be..bf10f6b 100644 --- a/src/routes/repository-public.ts +++ b/src/routes/repository-public.ts @@ -34,7 +34,7 @@ router.get( res.attachment(`${repo.repoId}.zip`); // cache the file for 6 hours - res.header("Cache-Control", "max-age=21600000"); + res.header("Cache-Control", "max-age=21600"); await pipeline(repo.zip(), res); } catch (error) { handleError(error, res); @@ -49,7 +49,7 @@ router.get( if (!repo) return; try { // ache the file for 6 hours - res.header("Cache-Control", "max-age=21600000"); + res.header("Cache-Control", "no-cache"); res.json(await repo.anonymizedFiles({ includeSha: false })); } catch (error) { diff --git a/src/server.ts b/src/server.ts index 83233aa..4709ab3 100644 --- a/src/server.ts +++ b/src/server.ts @@ -93,7 +93,7 @@ export default async function start() { express.static(path.join(__dirname, "..", "public"), { etag: true, lastModified: true, - maxAge: 3600000, // 1h + maxAge: 3600, // 1h }) );