Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 3c5637d

Browse files
committed
Update Cache-Control strategy
1 parent 590196e commit 3c5637d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

server/server.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ export class Server {
127127

128128
// set server header
129129
resp.setHeader('Server', 'Aleph.js')
130+
// by default, we use `Last-Modified` and `ETag` header to control cache
131+
resp.setHeader('Cache-Control', 'public, max-age=0, must-revalidate')
130132

131133
// set custom headers
132134
if (headers) {
@@ -135,9 +137,6 @@ export class Server {
135137
}
136138
}
137139

138-
// we use `Last-Modified` and `ETag` header to control cache
139-
resp.setHeader('Cache-Control', 'max-age=0')
140-
141140
// serve dist files
142141
if (pathname.startsWith('/_aleph/')) {
143142
if (pathname.startsWith('/_aleph/data/') && pathname.endsWith('.json')) {

0 commit comments

Comments
 (0)