If you get this error in nginx :
upstream sent too big header while reading response header from upstream
and your upstream is a lamp server ( possibly for others too) , the problem might be that you are sending a header that is too big for the current settings of nginx .
My problem was that I was setting a lot of cookies . I had output_buffering enabled in php and set to 4096 . Nginx was configuring with default proxy-ing values . After I digged a bit , I solved this by modifying output_buffering On in php . When is On , the header is sent when it’s finished and not in chunks (at least this is what I understand from php doc) . I tried with 9192 value , but same thing .
In nginx I was using default proxy configuration , with proxy_buffering on . After googling a bit , I found out some guys that had a simillar problem with fastcgi . The sollution was to increase the buffers sizes :
proxy_connect_timeout 90; proxy_send_timeout 180; proxy_read_timeout 180; proxy_buffer_size 16k; proxy_buffers 8 16k; proxy_busy_buffers_size 32k; proxy_intercept_errors on;
Proxy_intercept_error is optional . Also you can play with there values . Using higher values only makes nginx to use more memory . If you have plenty memory , this shouldn’t a problem 🙂