From 916c79c96c054ac5acabf027d54679d3b441bef4 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Wed, 3 Apr 2024 20:38:37 +0700 Subject: [PATCH] UBERF-6300: Not cache for index.html's (#5159) Signed-off-by: Andrey Sobolev --- server/front/src/index.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/server/front/src/index.ts b/server/front/src/index.ts index 0da6d30fd5..ddc59fbaac 100644 --- a/server/front/src/index.ts +++ b/server/front/src/index.ts @@ -31,7 +31,7 @@ import { v4 as uuid } from 'uuid' import { preConditions } from './utils' const cacheControlValue = 'public, max-age=365d' -const cacheControlNoCache = 'max-age=1d, no-cache, must-revalidate' +const cacheControlNoCache = 'public, no-store, no-cache, must-revalidate, max-age=0' async function minioUpload ( ctx: MeasureContext, @@ -316,10 +316,17 @@ export function start ( app.use( expressStaticGzip(dist, { serveStatic: { + cacheControl: true, + dotfiles: 'allow', maxAge: '365d', etag: true, lastModified: true, - index: false + index: false, + setHeaders (res, path) { + if (path.toLowerCase().includes('index.html')) { + res.setHeader('Cache-Control', cacheControlNoCache) + } + } } }) )