fix(fe2): index.html 404 being cached (#2199)
This commit is contained in:
committed by
GitHub
parent
e384f2d299
commit
9d91c0da22
@@ -1,10 +1,10 @@
|
||||
const noStaticAssetFoundRgx = /Cannot find static asset/i
|
||||
const notFoundMessageRegexes = [/Cannot find static asset/i, /Page not found/i]
|
||||
|
||||
export default defineNitroPlugin((nitroApp) => {
|
||||
nitroApp.hooks.hook('error', (err, { event }) => {
|
||||
if (!event) return
|
||||
|
||||
if (noStaticAssetFoundRgx.test(err.message)) {
|
||||
if (notFoundMessageRegexes.some((r) => r.test(err.message))) {
|
||||
setHeader(event, 'Cache-Control', 'no-store')
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user