Skip to content

Commit 3975a94

Browse files
committed
Fix cache header in JS server
1 parent 847e113 commit 3975a94

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

server/modules/assets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default async (
120120
let data = await readFile(path)
121121
let headers: Asset['headers'] = {}
122122
if (pathname.includes('/assets/') && HASHED.test(path)) {
123-
headers['Cache-Control'] = 'public, immutable'
123+
headers['Cache-Control'] = 'public, max-age=31536000, immutable'
124124
}
125125
if (contentType === 'text/html' && !pathname.includes('/ui')) {
126126
headers = getPageHeaders(data)

server/test/assets.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ test('serves static pages', async () => {
108108

109109
let css = await server.fetch('/assets/app-CiUGZyvO.css')
110110
checkHeaders(css, {
111-
'cache-control': 'public, immutable',
111+
'cache-control': 'public, max-age=31536000, immutable',
112112
'content-type': 'text/css'
113113
})
114114
equal(await css.text(), '*{}')

0 commit comments

Comments
 (0)