Skip to content

Commit

Permalink
Fix cache header in JS server
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Oct 20, 2024
1 parent 847e113 commit 3975a94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/modules/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default async (
let data = await readFile(path)
let headers: Asset['headers'] = {}
if (pathname.includes('/assets/') && HASHED.test(path)) {
headers['Cache-Control'] = 'public, immutable'
headers['Cache-Control'] = 'public, max-age=31536000, immutable'
}
if (contentType === 'text/html' && !pathname.includes('/ui')) {
headers = getPageHeaders(data)
Expand Down
2 changes: 1 addition & 1 deletion server/test/assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ test('serves static pages', async () => {

let css = await server.fetch('/assets/app-CiUGZyvO.css')
checkHeaders(css, {
'cache-control': 'public, immutable',
'cache-control': 'public, max-age=31536000, immutable',
'content-type': 'text/css'
})
equal(await css.text(), '*{}')
Expand Down

0 comments on commit 3975a94

Please sign in to comment.