proxy cache

Michał Jaszczyk jasiu85 at
Tue May 19 16:57:23 MSD 2009


I need a little bit of help in understanding how proxy cache works in
Nginx. I've already managed to set up the cache and it works. Now I'm
tweaking it and I'm having some trouble with the proxy_cache_valid
directive. How does it work exactly? In some recent changelog I found
that the cache now respects "Expires" and "Cache-Control" headers. How
does this relate to proxy_cache_valid? Imagine the following

1. proxy_cache_valid is set to 1h and upstream's response is valid for 2h.
2. proxy_cache_valid is set to 2h and upstream's response is valid for 1h.
3. proxy_cache_valid is set to 1h and upstream's response doesn't
contain any caching hints.

For how long will Nginx cache the response in each of the above scenarios?

Does Nginx respect "Pragma: no-cache" header?

Which "Cache-Control" header directives (see does
Nginx respect?

What happens if the client sends "If-Modified-Since" header?

How does Nginx deal with "Vary" header?

That's a lot of questions, sorry for that :). Answer to any of them
will be appreciated :). If someone has the time to answer, I'll try to
spend some time and update the Wiki.

Michał Jaszczyk

More information about the nginx mailing list