server { listen 80; server_name _; root /usr/share/nginx/html; gzip on; gzip_types text/css application/javascript application/json application/manifest+json image/svg+xml; # Hashed build output never changes. location /_app/immutable/ { add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } # The service worker and app shell must be re-checked so updates reach clients. location = /service-worker.js { add_header Cache-Control "no-cache"; try_files $uri =404; } # nginx's default MIME table has no entry for the PWA manifest. location ~ \.webmanifest$ { types { } default_type application/manifest+json; add_header Cache-Control "no-cache"; } # Client-side app: unknown paths fall back to the SPA shell. location / { add_header Cache-Control "no-cache"; try_files $uri $uri/ /index.html; } }