[nginx] Is proxy_cache_valid required?

Maxim Dounin mdounin at mdounin.ru
Fri Jul 25 16:49:26 UTC 2014


Hello!

On Fri, Jul 25, 2014 at 09:30:04AM -0700, Robert Paprocki wrote:

> Hello!
> 
> I had trouble this morning setting up a basic cache with a proxy. Based
> on the proxy documentation and
> http://nginx.com/resources/admin-guide/caching/, I did not expect to
> have to set proxy_cache_valid; however, when this directive was not set
> anywhere, I saw no cache files written.

The proxy_cache_valid directives are needed if backend response 
doesn't indicate cacheability of the response with "Cache-Control: 
max-age=...", "Expires", or "X-Accel-Expires" (or if these headers 
are ignored using the "proxy_ignore_headers" directive).

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list