January 21, 2010 05:49PM

nginx is currently giving me this error:

upstream sent too big header while reading response header

and returning a [i]502 Bad Gateway[/i] 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.
Subject Author Posted

How to increase the size of the gateway header buffer?

zmre January 21, 2010 05:49PM

Re: How to increase the size of the gateway header buffer?

zmre January 21, 2010 07:22PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 93
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready