caching issues with nginx as reverse-proxy

blue.outrigger nginx-forum at forum.nginx.org
Thu Jun 30 01:00:02 UTC 2016


Hi,
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.

    location ^~ /mycachepath {
        proxy_pass                http://upstreamservers;
        proxy_buffers             8 32K;
        proxy_buffer_size         64K;
        proxy_cache               proxy-cache;
        proxy_cache_key           "$scheme$host$request_uri|$request_body";
        proxy_cache_valid         200 1m;
        proxy_cache_methods       POST GET;
        proxy_ignore_headers      Cache-Control;
        add_header X-Cache-Status $upstream_cache_status;
    }


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 ? There is nothing in the logs except
for this statement - "[warn] 29768#0: *2329 a client request body is
buffered to a temporary file /var/cache/nginx/client_temp/0000000009," for a
given request.
Any help is much appreciated.

Thanks!

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,267961,267961#msg-267961



More information about the nginx mailing list