fix(nginx): disable caching for index.html to prevent stale JS bundles

Without Cache-Control: no-cache on index.html, browsers serve old
cached HTML referencing outdated JS bundle hashes after deployment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-04 10:57:01 +00:00
parent bf96fcf22c
commit 7295c9d243

View File

@@ -14,8 +14,15 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# SPA routing - all other routes serve index.html
# Cache static assets with content hash (JS, CSS) indefinitely
location ~* \.(js|css)$ {
try_files $uri =404;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# SPA routing - index.html must never be cached
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}