server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Hashed asset file names, so they can be cached hard. The HTML is not hashed # and must not be, or a redeploy would go unnoticed for a year. location /_astro/ { add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } location = /index.html { add_header Cache-Control "no-cache"; } # This page loads nothing from anywhere else, so it can say so. add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header X-Frame-Options "DENY" always; add_header Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self'; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'" always; gzip on; gzip_types text/css application/javascript image/svg+xml application/json; gzip_min_length 1024; location / { try_files $uri $uri/ /index.html; } error_page 404 /index.html; }