UBERF-6300: Not cache for index.html's (#5159)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-04-03 20:38:37 +07:00 committed by GitHub
parent 1e4978cfb8
commit 916c79c96c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
}
}
}
})
)