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:
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user