Nginx cache-control headers issue

Francis Daly francis at daoine.org
Thu Aug 1 17:27:02 UTC 2019


On Thu, Jul 25, 2019 at 12:02:27PM +0000, Andrew Andonopoulos wrote:

Hi there,

> Nginx decide which content to cache based on the configuration under "Location" + the cache key? For example I have proxy_cache which means will cache everything which match the specific location?
> 

nginx caching is described at, for example, 

https://www.nginx.com/blog/nginx-caching-guide/

with some more information at http://nginx.org/r/proxy_cache_valid

Whether the response from upstream is cached by nginx, depends on the
configuration and the details of the response.

Whether nginx responds to a client request with something from the cache,
also depends on the configuration.

And if you use third party modules, it is possible that they do something
that interferes with nginx's caching policy.

> I don't yet why I am getting cache miss for all the token based requests (m3u8 & ts), but I am wondering if is related to cache key and if will need to instruct neginx to check the token first and then cache it? Can this be done?
> 

I'm afraid "try it and see" is the best I can suggest.

If you see everything using the cache as desired when the tokens are
not used, but failing to do that when the tokens are used, then you
get to play "spot the difference" between the two pairs of requests
and responses.

Can you see -- does the upstream response go into the nginx cache in
both cases? If not, what is different in the case where it does not go in?

If the response does do into the nginx cache, then presumably it is not
taken from the cache in one case -- what is different there, instead?


Is the "token" part of the cache key? And do different requests have
different tokens for the same content? If so, then the second request
will not try to read from the cache entry of the first request.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list