我经常用
Cache-Control: no-cache
或
Cache-Control: max-age=0
规范说must-revalidate
是为了max-stale
...(服务器问题max-stale
?)
因此,如果对于普通的 Web 服务器、Apache 或带有 Mongrels 的 Rails,那么我认为通常没有 max-stale
,所以不需要 must-revalidate
?
最佳答案
must-revalidate
应该由服务器指定,如果客户端获得陈旧的响应是不正确(而不仅仅是次优的)。这适用于您提到的所有带有 max-stale
的请求。如果缓存暂时失去与源的连接,它也适用(在这种情况下,允许缓存返回带有 Warning
header 的陈旧条目)。话虽这么说,我认为你是对的,在实践中特别不需要这个指令;它最常见于源端希望让客户端缓存资源副本(出于节省带宽的目的)但始终在使用前对其进行验证的情况,如:
缓存控制:私有(private),max-age=0,必须重新验证
关于http - 在 "must-revalidate"中使用 "Cache-Control: no-cache, must-revalidate"是多么必要,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4006839/