server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Hashed build assets must never fall back to index.html. # Otherwise missing JS/CSS returns text/html and browsers throw MIME errors. location /assets/ { try_files $uri =404; access_log off; expires 1y; add_header Cache-Control "public, immutable"; } location ~* \.(?:js|css|png|jpg|jpeg|gif|ico|svg|webp|woff2?|ttf|eot|webmanifest|map)$ { try_files $uri =404; access_log off; expires 7d; add_header Cache-Control "public"; } location / { try_files $uri $uri/ /index.html; } }