Nginx proxy_no_cache 和 proxy_cache_bypass
·
问题:Nginx proxy_no_cache 和 proxy_cache_bypass
这是文档:
代理_缓存_绕过
定义不从缓存中获取响应的条件。如果字符串参数中至少有一个值不为空且不等于“0”,则不会从缓存中获取响应:
proxy_cache_bypass $cookie_nocache $arg_nocache$arg_comment;
proxy_cache_bypass $http_pragma $http_authorization;
可以与 proxy\no\cache 指令一起使用。
代理_no_cache
定义不将响应保存到缓存的条件。如果字符串参数中至少有一个值不为空且不等于“0”,则不会保存响应:
proxy_no_cache $cookie_nocache $arg_nocache$arg_comment;
proxy_no_cache $http_pragma $http_authorization;
可以与 proxy_cache_bypass 指令一起使用。
这是否意味着如果我想完全排除缓存中的某些内容,我应该同时设置proxy_no_cache
和proxy_cache_bypass
?我只设置proxy_cache_bypass
可以吗?
解答
是的。
如果您只是将 proxy_cache_bypass 在您不想缓存的页面上设置为 true(例如登录用户),那么它们仍将保存到缓存中并提供给应该获取缓存页面的人(例如. 未登录的用户)。
但是将 proxy_cache_bypass 和 proxy_no_cache 都设置为 true 意味着这些用户既不接收也不贡献缓存。
更多推荐
所有评论(0)