upstream sent too big header while reading response header from upstream

Maxim Dounin mdounin at mdounin.ru
Thu Feb 6 12:18:57 UTC 2014


Hello!

On Wed, Feb 05, 2014 at 03:48:50PM -0800, Jeroen Ooms wrote:

> After I added some CORS headers to my API, one of the users of my
> nginx-based system complained about occasional errors with:
> 
> upstream sent too big header while reading response header from upstream
> 
> He also reported to have worked around the issue using:
> 
> proxy_buffers 8 512k;
> proxy_buffer_size 2024k;
> proxy_busy_buffers_size 2024k;
> proxy_read_timeout 3000;
> 
> However unfortunately I was unable to reproduce this problem myself. I
> also had a hard time figuring out what the exact problem is.
> 
> Some questions:
> 
>  - What exactly does this error mean? Does it mean that response
> contained too many headers? How many is too many?

Response headers should fit into proxy_buffer_size, see
http://nginx.org/r/proxy_buffer_size.  If they don't, the error 
is reported.

>  - Is it wise to increase the buffer sizes as the user reported? What
> would be sensible defaults?

Certainly no.  In most cases defaults used (4k on most platforms) 
are appropriate.  If big cookies are expected to be returned by a 
proxied server, something like 32k or 64k will be good enough.  If 
larger values are needed, it indicate backend problem.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list