Skip to content

Commit a760352

Browse files
committed
chore(netlify): prevent stale HTML caching to avoid ChunkLoadError (no-cache for *.html and sw.js)
1 parent bfa3230 commit a760352

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

netlify.toml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,23 @@
7575
[[headers]]
7676
for = "/fonts/*"
7777
[headers.values]
78-
Cache-Control = "public, max-age=31536000, immutable"
78+
Cache-Control = "public, max-age=31536000, immutable"
79+
80+
# Prevent stale HTML from referencing old chunk filenames
81+
[[headers]]
82+
for = "/index.html"
83+
[headers.values]
84+
Cache-Control = "no-cache, no-store, must-revalidate"
85+
Pragma = "no-cache"
86+
Expires = "0"
87+
88+
[[headers]]
89+
for = "/*.html"
90+
[headers.values]
91+
Cache-Control = "no-cache"
92+
93+
# Ensure service worker is always fresh if enabled later
94+
[[headers]]
95+
for = "/sw.js"
96+
[headers.values]
97+
Cache-Control = "no-cache"

0 commit comments

Comments
 (0)