I’m using an old version of nginx (0.8) on centos as reverse proxy for
caching POST requests in front of two upstream servers.
The servers are built for receiving post requests and returning media,
sometimes 10 MB in size.
When the responses are small, nginx caches work fine. When I get a 2 MB
response, nginx doesn’t cache the POST response.
I tried increasing proxy buffer size and busy buffer size but it had no
effect, how do I cache large POST responses in nginx?
On Sat, Dec 29, 2012 at 12:46:21PM -0500, nurettin wrote:
I’m using an old version of nginx (0.8) on centos as reverse proxy for
caching POST requests in front of two upstream servers.
The servers are built for receiving post requests and returning media,
sometimes 10 MB in size.
When the responses are small, nginx caches work fine. When I get a 2 MB
response, nginx doesn’t cache the POST response.
I tried increasing proxy buffer size and busy buffer size but it had no
effect, how do I cache large POST responses in nginx?
Normally responses for POST requests are not cached (even if
response indicates it is cacheable) as there is no good generic
way to construct a cache key.
If you want nginx to cache responses to POST requests, you should
instruct it to do so explicitly using the “proxy_cache_methods”
directive, e.g.
On Fri, Jan 04, 2013 at 01:53:39AM -0500, nurettin wrote:
Hi Maxim D.!
The proxy already caches small post responses. My cache key is request uri
and body. I just don’t know how to increase the buffer.
There are no buffers which influence request cacheability.
Responses are either cached or not regardless of their size.
I would recommend you to check if max_size= configured in
proxy_cache_path (if any) is big enough to store responses you
want to cache. If it is, you may want to produce debug log to
investigate what goes on, see here for details
On Tue, Jan 08, 2013 at 06:57:08AM -0500, nurettin wrote:
I have debug on error.log, here’s the output:
code 0
2013/01/08 13:51:20 [notice] 32764#0: signal 29 (SIGIO) received
I’m not sure what to do here.
Ah, ok, the error message logged suggests that you need to
increase upstream buffer - it’s used to store cache header and
it’s too small to hold your cache key with request body included.
The “increase upstream buffer size” wording is indeed not very
helpful, it was made more specific in nginx 1.1.0+. In case of
proxy, you have to increase proxy_buffer_size, see Module ngx_http_proxy_module.