Nginx 502 Gateway Errors

Nginx 502’s - random form Nginx big header response - stackoverflow

Just spent the last couple hours on this bug where Tint was returning 502’s when users try to add twitter accoutns. It turns out that Nginx has difficulty handling requests with large headers. Passing twitter id’s using cookie-based sessions was enough to result in mysterious 502’s.

Solution: Put the following in the nginx.conf

proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

In other news, today we launched lakersnation.com, and here is a graph of servers undergoing some load.

Lakersnation.com load testing

The new load was successfully handled and fistpounds were had.