server { listen 80; root /usr/share/nginx/html; index index.html; location / { try_files $uri $uri/ /index.html; } # Never let the browser serve a stale SPA shell: it references hashed asset # filenames, so a cached index.html strands users on an old build after a # deploy (Edge heuristically caches it when no Cache-Control is set). Force # revalidation — a cheap 304 when unchanged — so new deploys are picked up. location = /index.html { add_header Cache-Control "no-cache"; } location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } }