index.html is served with Cache-Control: no-cache so the browser always fetches the latest version with updated asset hashes. Hashed assets under /assets/ are cached indefinitely since their filenames change on rebuild. This prevents browsers from serving old cached JS bundles (including the broken obfuscated build) after a new deployment.
30 lines
808 B
Nginx Configuration File
30 lines
808 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
server_tokens off;
|
|
|
|
# Root directory for static files (must match Docker COPY path)
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# index.html must never be cached so new asset hashes are picked up
|
|
location = /index.html {
|
|
add_header Cache-Control "no-cache";
|
|
try_files $uri /index.html;
|
|
}
|
|
|
|
# Hashed assets are immutable — cache indefinitely
|
|
location /assets/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# SPA fallback
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Enable gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
}
|