server { listen 8080; server_name _; root /usr/share/nginx/html; index index.html; location ~ \.mjs$ { types { text/javascript mjs; } default_type text/javascript; try_files $uri =404; } # SPA fallback location / { try_files $uri $uri/ /index.html; } # Backend API — upstream host injected from SPIN_BACKEND_URL (envsubst). # local docker-compose: backend:8080 ; cluster: spin-backend.internal.svc.cluster.local:80 location /api/ { proxy_pass http://${SPIN_BACKEND_URL}; 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; client_max_body_size 50m; } }