这是文档:
proxy_cache_bypass
Defines conditions under which the response will not be taken from a cache. If at least one value of the string parameters is not empty and is not equal to “0” then the response will not be taken from the cache:
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
proxy_cache_bypass $http_pragma $http_authorization;
Can be used along with the proxy_no_cache directive.proxy_no_cache
Defines conditions under which the response will not be saved to a cache. If at least one value of the string parameters is not empty and is 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 along with the proxy_cache_bypass directive.
这是否意味着如果我想完全排除缓存中的某些内容,我应该同时设置
proxy_no_cache
和 proxy_cache_bypass
?如果我只设置proxy_cache_bypass
可以吗? ?
最佳答案
是的。
如果您只有 proxy_cache_bypass 在您不希望缓存的页面(例如,登录用户)上设置为 true,那么它们仍将被保存到缓存中并提供给应该获取缓存页面的人(例如,非登录用户)。
但同时设置 proxy_cache_bypass 和 proxy_no_cache 为 true 意味着这些用户既不接收也不贡献缓存。
关于caching - Nginx proxy_no_cache 和 proxy_cache_bypass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31694486/