Improve cache for hashed js files
This commit is contained in:
parent
1600bb69b9
commit
28e9aea290
1 changed files with 3 additions and 1 deletions
|
@ -25,7 +25,9 @@ async function redirectMiddleware(ctx, next) {
|
|||
request: { url },
|
||||
} = ctx;
|
||||
|
||||
if (STATIC_ASSET_PATHS.includes(url) || (url.startsWith('/public/ui-') && url.endsWith('.js'))) {
|
||||
const HASHED_JS_REGEX = /^\/public\/.*[a-fA-F0-9]{12}\.js$/i;
|
||||
|
||||
if (STATIC_ASSET_PATHS.includes(url) || HASHED_JS_REGEX.test(url)) {
|
||||
ctx.set('Cache-Control', `public, max-age=${SIX_MONTHS_IN_SECONDS}`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue