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
- proxy_cache_valid is set to 1h and upstream’s response is valid for
- proxy_cache_valid is set to 2h and upstream’s response is valid for
- 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
Does Nginx respect “Pragma: no-cache” header?
Which “Cache-Control” header directives (see
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.