Nginx http proxy caching

Jim Ursetto nginx-forum at
Mon May 10 23:02:09 MSD 2010

Vinay Y S Wrote:
> Hi,
> Is there developer documentation on how http
> caching works in nginx? I'm
> seeing weird caching behavior where it's caching
> responses with Cache-Control: private headers.

nginx completely ignores the `private` keyword and
will cache your document regardless.

> As I've asked in another thread, I'm also trying
> to understand how I can
> enable/disable caching per request based on a
> cookie or a header set by
> upstream server.

You can send `Cache-control: max-age=0` or 
`Cache-control: no-cache` to disable nginx proxy cache.

Note that because `private` is ignored, you cannot tell
nginx to not use the proxy cache while still allowing
the browser to cache (for example, 
`Cache-control: max-age=3600, private`).  You can only
disable the proxy cache in the configuration file based
on the current Location.  I don't really understand this
behavior; I think private should be honored.

Posted at Nginx Forum:,42865,85008#msg-85008

More information about the nginx mailing list