[edit] proxy_cache

Syntax: proxy_cache zone | off
Default: off
Context: http
server
location
Reference: proxy_cache


This directive sets name of zone for caching. The same zone can be used in multiple places.

The cache honors backend's "Expires", "Cache-Control: no-cache", and "Cache-Control: max-age=XXX" headers since version 0.7.48. Since version 7.66, "private" and "no-store" are also honored. nginx does not handle "Vary" headers when caching. In order to ensure private items are not served to all users unintentionally by the cache, the back-end can set "no-cache" or "max-age=0", or the proxy_cache_key must include user-specific data such as $cookie_xxx. However, using cookie values as part of proxy_cache_key can defeat the benefits of caching for public items, so separate locations with different proxy_cache_key values might be necessary to separate private and public items.

The cache depends on proxy buffers, and will not work if proxy_buffers is set to off.

The following response headers flag a response as uncacheable unless they are ignored:


Module: HttpProxyModule