Open axmad386 opened 1 year ago
My workaround is to set dev
to true
and manage cache control via setHeader
something like this
sirv(public_path(),{
dev:true,
setHeaders: (res) => {
res.setHeader("Cache-Control", "public,max-age=31536000,immutable");
},
})
this will make sirv still serve the file dynamically but cache control is sent. So browser will cache the file
I know in the docs that with dev = true it will traverse the file system on every request. Is it possible to use dev mode but the http response still set the cache control? It will useful when we want to make public folder contain dynamic asset, we can add another asset to it, but when we access it browser will cache it.