caching issues with nginx as reverse-proxy

Francis Daly francis at daoine.org
Thu Jun 30 07:14:00 UTC 2016


On Wed, Jun 29, 2016 at 09:00:02PM -0400, blue.outrigger wrote:

Hi there,

> I am using nginx as a reverse proxy and using the proxy-cache, I use the
> request body as a cache key as shown below.

>         proxy_cache_key           "$scheme$host$request_uri|$request_body";

http://nginx.org/r/$request_body

If the request body was not read to a memory buffer, this variable is
presumably empty (and therefore: the same for all requests).

> However, I observe that smaller request bodies the cache works perfectly but
> if the request body gets too big then it will actually *always* return the
> cached version. Does anyone have any idea what's going on and if someone
> also has come across a similar issue ?

Set your client_body_buffer_size big enough that it will hold the entire
request, if you want to cache POSTs this way.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list