http - 在 "must-revalidate"中使用 "Cache-Control: no-cache, must-revalidate"是多么必要

标签 http http-headers cache-control

我经常用

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/

相关文章:

http-headers - 缓存控制最大年龄元标记未注册

java - 如何在同一个 HTTP 请求中以字节形式发送图像并一起发送 json 数据?

apache - 在 Apache 中启用 css 和 js 文件的缓存

javascript - 如何在 Chrome devtools 中查看 HTTP 缓存使用的空间?

c# - Asp.net Response.Redirect - 不正确的推荐人

php - 使用 CURL 检索 header 字符串后,如何在 PHP 中检索各个 header 字段值?

c# - Bad Request的Cache-Control最佳实践(400)

http - 是否可以将空格字符传递给 cgi?

java - Google Apps 脚本是否可以通过 HTTP POST 接收文件?

python - 如何在 urllib.urlretrieve 中捕获 404 错误