Nginx proxy_no_cache and proxy_cache_bypass

Here's the documentation:

proxy_cache_bypass
Defines the conditions under which the response is not taken from the cache. If at least one value of the string parameters is not empty and not equal to "0", then the response will not be received from the cache:
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;


proxy_cache_bypass $http_pragma $http_authorization;


Can be used together with the proxy_no_cache directive.

proxy_no_cache
Specifies the conditions under which the response will not be saved in the cache. If at least one value of the string parameters is not empty and not equal to "0", then the response will not be saved:
proxy_no_cache $cookie_nocache $arg_nocache$arg_comment;


proxy_no_cache $http_pragma $http_authorization;


Can be used in conjunction with the proxy_cache_bypass directive.

Does this mean that if I want to completely exclude something in the cache, I have to install both proxy_no_cache

and proxy_cache_bypass

? Is it ok if I just installed it proxy_cache_bypass

?

+3


source to share


1 answer


Yes.

If you only have proxy_cache_bypass set to true on pages you don't want to cache (like logged in users), they will still be cached and served by people who need to get cached pages (like no login) ...



But setting both proxy_cache_bypass and proxy_no_cache to true means that these users do not receive or contribute to the cache.

+8


source







All Articles