upstream sent too big header while reading response header from upstream

Maxim Dounin mdounin at
Tue Feb 11 10:55:01 UTC 2014


On Mon, Feb 10, 2014 at 09:45:50AM -0800, Jeroen Ooms wrote:

> On Mon, Feb 10, 2014 at 5:15 AM, Maxim Dounin <mdounin at> wrote:
> > it is likely the cause, as the config includes the following lines:
> >
> >     proxy_cache_methods POST;
> >     proxy_cache_key "$request_method$request_uri$request_body";
> >
> Yikes I was not aware that the cache key gets stored into the buffers
> as well. Is this mentioned in the manual anywhere?

Likely no.  It's mostly proxy cache implementation detail - it needs a 
way to write a cache header (which includes key) to a cache file, 
and places it to the buffer just before response headers from 
an upstream.

> So we need to set proxy_buffer_size to a value greater than the sum of
> client_body_buffer_size + header size?

If you use $request_body in the cache key - yes.  And don't forget 
to add other variables in proxy_cache_key.

> Or alternatively, is there a
> way that to use a fixed length hash of the request body in the
> proxy_cache_key?

As of now hashes may be calculated using, e.g., the embedded perl 
or 3rd party modules.

Maxim Dounin

More information about the nginx mailing list