Interview Prep/Networking/Load balancers and reverse proxies

nginx returns 502 for login requests only, with `upstream sent too big header while reading response header from upstream`.

IntermediateTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → The upstream's response headers exceed proxy_buffer_size (4 KB or 8 KB by default). Login responses often carry large Set-Cookie headers (JWTs, SSO cookies) that push them over.

Diagnose →

curl -s -o /dev/null -D - http://127.0.0.1:8080/login -d 'u=x&p=y' | wc -c

Fix →

proxy_buffer_size 16k;
proxy_buffers 8 16k;
proxy_busy_buffers_size 32k;

For FastCGI the equivalents are fastcgi_buffer_size / fastcgi_buffers.

Prevent → Keep cookies small (store session data server side, reference by ID) and include auth flows in load tests.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies