server { listen 80; server_name _; # API -> api container. The SPA calls same-origin /api/... (environment.prod.ts). location /api/ { proxy_pass http://api:8080/api/; 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; } # Everything else -> the Angular static app (its own nginx does SPA fallback). location / { proxy_pass http://app:80; } }