server { listen 80; root /usr/share/nginx/html; index index.html; # SPA fallback — all unknown routes serve index.html location / { try_files $uri $uri/ /index.html; } # The service worker and manifest must be re-checked on every load, # otherwise phones keep running an old build. location ~* ^/(sw\.js|workbox-.*\.js|manifest\.webmanifest|index\.html)$ { add_header Cache-Control "no-cache"; } # Hashed build assets location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; } }