server { listen 80; root /usr/share/nginx/html; index index.html; error_page 404 /404.html; location / { try_files $uri $uri/index.html $uri.html =404; } location /api/ { proxy_pass http://api:3001/api/; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } # Astro's hashed _astro/ files — content-addressed, safe to cache forever location /_astro/ { expires 1y; add_header Cache-Control "public, immutable"; } # Images + fonts — long cache but NOT immutable (can be updated) location ~* \.(png|jpg|jpeg|gif|ico|svg|woff2?)$ { expires 30d; add_header Cache-Control "public"; } # HTML pages — short cache so deploys take effect quickly location ~* \.html$ { add_header Cache-Control "no-cache"; } # Security headers are set on the outer (host) nginx — do NOT duplicate here }