Skip to content

Commit e3a336b

Browse files
cdemibenmccann
andauthored
fix(adapter-node): only send cache header when static resource is 200 (#9394)
fixes #9393 --------- Co-authored-by: Ben McCann <[email protected]>
1 parent c45c35e commit e3a336b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/khaki-schools-invent.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-node': patch
3+
---
4+
5+
fix: only send cache header when static resource is 200

packages/adapter-node/src/handler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function serve(path, client = false) {
3737
client &&
3838
((res, pathname) => {
3939
// only apply to build directory, not e.g. version.json
40-
if (pathname.startsWith(`/${manifest.appPath}/immutable/`)) {
40+
if (pathname.startsWith(`/${manifest.appPath}/immutable/`) && res.statusCode === 200) {
4141
res.setHeader('cache-control', 'public,max-age=31536000,immutable');
4242
}
4343
})

0 commit comments

Comments
 (0)