server { listen 80; root /usr/share/nginx/html; # Vite puts a content hash in these file names, so they never change. location /assets/ { add_header Cache-Control "public, max-age=31536000, immutable"; } # Not in every nginx mime.types; browsers expect this type for the PWA manifest. location = /manifest.webmanifest { types { application/manifest+json webmanifest; } add_header Cache-Control "no-cache"; } # index.html and /i18n/*.json keep their names across deploys. Without # no-cache the browser shows old translation keys or loads an old bundle. location / { index index.html index.htm; add_header Cache-Control "no-cache"; # Handle React Router navigation try_files $uri $uri/ /index.html; } }