events {} http { upstream api { server api:8034; } upstream web { server web:80; } server { listen 80; # Pure API calls location /api/ { proxy_pass http://api; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; # Replace the client's X-Forwarded-For: the api trusts this gateway's header proxy_set_header X-Forwarded-For $remote_addr; } # Remote probes (the probe protocol). A compressed results batch can be a little over # 1 MiB, which is more than nginx's default client_max_body_size of 1m allows. location /probe/ { client_max_body_size 2m; proxy_pass http://api; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; # Replace the client's X-Forwarded-For: the api trusts this gateway's header proxy_set_header X-Forwarded-For $remote_addr; } # socket.io location /socket.io/ { proxy_pass http://api; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } # Everything else → static SPA location / { proxy_pass http://web; } } }