# Same-origin reverse proxy: serves the SPA and forwards /api/v1 to the API. # TLS termination happens at the platform edge in production; locally this # server is exposed on plain HTTP at 127.0.0.1:8080. server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Import uploads are capped at 20 MB by product rules; leave headroom. client_max_body_size 25m; # Baseline security headers. TLS/HSTS/CSP are configured at the platform # edge (see docs/operations/beta-release-runbook.md). add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "DENY" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; gzip on; gzip_min_length 1024; gzip_types text/css application/javascript application/json image/svg+xml; # Block dotfiles (except ACME challenges if ever needed). location ~ /\. { deny all; } # Reverse proxy to the FastAPI API. No URI part on proxy_pass, so the # /api/v1 prefix is preserved end to end. location /api/v1/ { proxy_pass http://api:8000; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Request-Id $request_id; proxy_connect_timeout 5s; proxy_read_timeout 60s; } # Hashed static assets are immutable. location /assets/ { access_log off; expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # SPA fallback for client-side routes. location / { try_files $uri $uri/ /index.html; } }