502 errors, upstream sent too big header

We seem to be getting sporadic 502 errors, mostly when users are logging
in.
We run a Mediawiki based website, are running nginx 0.9.5, php-fpm
5.3.5.

The error:

2011/04/04 10:41:34 [error] 30517#0: *2143711 upstream sent too big
header
while reading response header from upstream, client: 192.168.100.5,
server:
_, request: “POST
/index.php?title=Special:Userlogin&action=submitlogin&type=login&returnto=Main-Page
HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host:
www.wikihow.com”,
referrer: “http://www.wikihow.com/Special:Userlogin?returnto=Main-Page

Our nginx.conf proxy buffer settings:

proxy_buffers 16 16k;
proxy_buffer_size 32k;

We’ve tried increasing these values from the defaults a few times, and
it
doesn’t seem to fix the issue.

Do you have any suggestions on how to fix this?

Thanks,
Travis

On Mon, Apr 04, 2011 at 04:52:22PM -0400, Travis Derouin wrote:

referrer: “http://www.wikihow.com/Special:Userlogin?returnto=Main-Page

Our nginx.conf proxy buffer settings:

proxy_buffers 16 16k;
proxy_buffer_size 32k;

We’ve tried increasing these values from the defaults a few times, and it
doesn’t seem to fix the issue.

Do you have any suggestions on how to fix this?

 fastcgi_buffers 16 16k;
 fastcgi_buffer_size 32k;


Igor S.
http://sysoev.ru/en/

Hi,

I’m getting this same error (please see log output below) with
Nginx(0.8.54) and Passenger(3.0.6) using GET requests with really long
URIs.

My assumption is that fastcgi_buffer* directives won’t apply to my
configuration since the request is being handled by passenger instead of
a php/perl fastcgi socket.

I’ve tried defining the proxy_buffer* settings like Travis described in
his initial post, but that didn’t resolve the error I’m experiencing.

I’ve defined “large_client_header_buffers 8 16k;” in the server
context, but this doesn’t alleviate the error either.

Is ‘large_client_header_buffers’ the proper directive I should be using?
If not, is there a directive I can use to increase the response header
size limit?

Thanks for any insight into this,
Mike P.


2011/05/01 09:57:41 [error] 12176#0: *4537092 upstream sent too big
header while reading response header from upstream, client: x.x.x.x,
server: hostname.tld, request: “GET
/heroku/resources/18623?<REALLY_LONG_URI_REMOVED> HTTP/1.1”, upstream:
"passenger:unix:/

According to passenger’s documentation, it doesn’t appear that a
directive exists to adjust any header size limitations.

Also, Phusion’s CTO doesn’t mention any possible solution here regarding
the same error: http://goo.gl/ZPXvO

If there is no such adjustment that can be made via passenger to
alleviate this error, is there also no possible solution within Nginx?

Thanks!

On Mon, Apr 04, 2011 at 04:52:22PM -0400, Travis Derouin wrote:

referrer: “http://www.wikihow.com/Special:Userlogin?returnto=Main-Page

Our nginx.conf proxy buffer settings:

proxy_buffers 16 16k;
proxy_buffer_size 32k;

We’ve tried increasing these values from the defaults a few times, and it
doesn’t seem to fix the issue.

Do you have any suggestions on how to fix this?

fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

since you use fastcgi, but not proxy.


Igor S.

Hello!

On Mon, May 02, 2011 at 06:08:24AM +0200, Mike P. wrote:

Hi,

I’m getting this same error (please see log output below) with
Nginx(0.8.54) and Passenger(3.0.6) using GET requests with really long
URIs.

My assumption is that fastcgi_buffer* directives won’t apply to my
configuration since the request is being handled by passenger instead of
a php/perl fastcgi socket.

You have to tune appropriate settings provided by passenger
module. Please refer to passenger documentation for exact names,
most likely passenger_buffer_size and so on.

[…]

Maxim D.

Maxim,

Thanks! This makes a lot more sense now. I’ll pursue a resolution with
passenger at this time. Hopefully this is something that they can
eventually resolve with a future release.

Mike P.

Hello!

On Tue, May 03, 2011 at 04:03:29AM +0200, Mike P. wrote:

According to passenger’s documentation, it doesn’t appear that a
directive exists to adjust any header size limitations.

Also, Phusion’s CTO doesn’t mention any possible solution here regarding
the same error: http://goo.gl/ZPXvO

Ah, indeed: looking though code suggests they unconditionally set
buffer size to pagesize and doesn’t allow it to be changed.

If there is no such adjustment that can be made via passenger to
alleviate this error, is there also no possible solution within Nginx?

You may consider using another module to talk to backends,
standard proxy or fastcgi may be a good solution.

Maxim D.

Hello!

On Mon, Jun 27, 2011 at 10:38:42PM -0400, assistlydavid wrote:

proxy_buffer_size, fastcgi_buffers, fastcgi_busy_buffers_size,
fastcgi_buffer_size, large_client_header_buffers.

Isn’t this error message coming from nginx, complaining about the size
of the header returned from passenger? Given that, surely there’s some
way I can tell nginx to allow a larger header size?

As it was already said in this thread, passenger module
unconditionally set buffer size and it’s not configurable. There
should be something like “passenger_buffer_size” directive, but
it doesn’t exists.

Any suggestions?

Either bug passenger module authors or use another module to talk
to backends (e.g. standard fastcgi or proxy).

Maxim D.

We are having the same problem, only today 106 errors like this
registered in our log.

If anyone has any insights about this, please post a reply, we’re
desperate to fix this.

Posted at Nginx Forum:

We’re having the same problem:

upstream sent too big header while reading response header from

upstream

Where:

upstream: "passenger:unix:/passenger_helper_server:"

I tried every one of proxy_buffers, proxy_busy_buffers_size,
proxy_buffer_size, fastcgi_buffers, fastcgi_busy_buffers_size,
fastcgi_buffer_size, large_client_header_buffers.

Isn’t this error message coming from nginx, complaining about the size
of the header returned from passenger? Given that, surely there’s some
way I can tell nginx to allow a larger header size?

Any suggestions?

Cheers,
David.

Posted at Nginx Forum:

Guys did you see that Passenger 3.0.8 was released today, with this in
the changelog:

[Nginx] Added the options passenger_buffer_size, passenger_buffers and
passenger_busy_buffers_size. These options are similar to
proxy_module’s similarly named options. You can use these to e.g.
increase the maximum header size limit.

Posted at Nginx Forum: