nginx post response doesn't get cached

Maxim Dounin mdounin at mdounin.ru
Fri Jan 4 03:47:37 UTC 2013


Hello!

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.

    proxy_cache_methods GET HEAD POST;

See http://nginx.org/r/proxy_cache_methods.

-- 
Maxim Dounin
http://nginx.com/support.html



More information about the nginx mailing list