Nginx proxy_no_cache 和 proxy_cache_bypass
Nginx proxy_no_cache and proxy_cache_bypass
这是文档:
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 设置为您不想缓存的页面(例如登录用户),那么它们仍会保存到缓存中并服务于应该获得缓存页面的人(例如,未登录的用户)。
但是将 proxy_cache_bypass 和 proxy_no_cache 都设置为 true 意味着这些用户既不接收也不贡献缓存。
这是文档:
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 设置为您不想缓存的页面(例如登录用户),那么它们仍会保存到缓存中并服务于应该获得缓存页面的人(例如,未登录的用户)。
但是将 proxy_cache_bypass 和 proxy_no_cache 都设置为 true 意味着这些用户既不接收也不贡献缓存。