我要申请Cache-Control: must-revalidate,no-cache,no-store
来自后端 REST 服务的所有响应。我有两个问题:
编辑:发现这个:https://devcenter.heroku.com/articles/increasing-application-performance-with-http-cache-headers#cache-prevention .是说浏览器可能会在没有明确配置时选择缓存,所以这意味着是的,如果我想确保缓存被禁用,应该配置它。
最佳答案
简短:是的,即使不存在显式控件,缓存也可能会缓存响应,您需要明确禁止它。
HTTP caching specification Section 3禁止缓存响应时列出。它表明只要响应代码是可缓存的,就可以缓存响应。可缓存的响应代码列表在 HTTP specification section 6.1 中:
Responses with status codes that are defined as cacheable by default (e.g., 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501 in this specification) can be reused by a cache with heuristic expiration unless otherwise indicated by the method definition or explicit cache controls...
“启发式到期”被定义为当不存在显式控制时分配的到期时间。 ( HTTP caching specification section 4.2. )
关于rest - 显式禁用 REST 服务的缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39129932/