server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Cache hashed assets aggressively; never cache index.html. location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # SPA: serve index.html for any route (hash routing / deep links). # index.html must NOT be cached — it points at the hashed asset bundle, so a # stale cached copy keeps loading the previous deploy's JS. (nginx add_header # doesn't inherit into a location that sets its own, so the security headers # are repeated here.) # # $uri.html comes before $uri/ so the build-time SEO pages # (/alternatives/opus-clip and friends) are served at their clean path with a # 200. Resolving them as directories instead would make nginx 301 to a # trailing-slash URL, so every canonical would point at a redirect. location / { try_files $uri $uri.html $uri/ /index.html; add_header Cache-Control "no-store, must-revalidate" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; } # Basic security headers. add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; }