How to increase the size of the gateway header buffer?

zmre nginx-forum at nginx.us
Fri Jan 22 01:49:38 MSK 2010


Hello,

nginx is currently giving me this error:


upstream sent too big header while reading response header



and returning a 502 Bad Gateway message to the browser.

With debugging turned on, I can see that my PHP application (SilverStripe) is adding two large headers (X-Include-JS and X-Include-CSS) to the HTTP response of around 3,000 characters each and the first one of these is exceeding a buffer size limit in nginx.

So I've spent the last few hours adding every buffer size related configuration option I can find to my nginx.conf file and setting them to high values like 512k, but none of these changes has fixed the problem.  

To be more specific, I have tried all of these settings:

    client_body_buffer_size     512k;
    client_header_buffer_size   512k;
    client_max_body_size          1m;
    large_client_header_buffers 4 512k;
    proxy_buffers 4 512k;
    proxy_busy_buffers_size 512k;
    proxy_buffer_size 512k;
    fastcgi_buffers 4 512k;
    fastcgi_buffer_size 512k;
    fastcgi_busy_buffers_size 512k;

Also, I tried upgrading from the 0.6 series to 0.8.31, but at this point I'm still stuck.  I'm even willing to compile code if the fix requires changing a constant.

Note also that I've tried more reasonable numbers like 16k, which should be more than enough since the header in its entirety is less than 8k and each line less than 4k, but they didn't work either.

Any help, tips, or pointers would be greatly appreciated.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,44091,44091#msg-44091




More information about the nginx mailing list