caching - 如果 Cache-Control 有 `no-cache` 和 `max-age=900` 会发生什么?

标签 caching proxy no-cache fastly max-age

如果我将服务器响应设置为:Cache-Control: private,no-cache,max-age=900 ?
如果标题是这样的,会发生什么:Cache-Control: public,no-cache,max-age=900 ?

因为它有一个 no-cache浏览器(或代理服务器)是否考虑max-age ?

最佳答案

RFC documents 中所述:

If the no-cache directive does not specify a field-name, then a cache MUST NOT use the response to satisfy a subsequent request without successful revalidation with the origin server. This allows an origin server to prevent caching even by caches that have been configured to return stale responses to client requests.



结果,如果no-cache已在服务器的响应中定义,这意味着浏览器(和任何中间缓存)将在每个请求上“重新验证”(也就是向源服务器发出请求并返回其响应,而不是使用任何缓存内容)。

所以,要清楚地回答你的问题:

Since it has a no-cache whether browser (Or proxy server) consider the max-age?



不,浏览器不会考虑 max-age (鉴于浏览器可以处理 no-cache 指令,因为某些 HTTP 1.0 浏览器/缓存可能无法识别此指令)。

关于caching - 如果 Cache-Control 有 `no-cache` 和 `max-age=900` 会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50039634/

相关文章:

c - 如何使用程序检查总缓存大小

caching - Redis缓存中如何定义 “regions”?

java - 如何为作为 Windows 服务运行的 Java 应用程序设置代理

docker - 使用tor\socks对特定http的代理请求

html - 如何防止某些背景图像缓存

ios - 当setImageWithUrl显示缓存的图像时,白色闪烁

caching - tomcat 6.0集群环境下如何实现缓存同步?

c - 使用recv从套接字接收数据不起作用

caching - 如何在 Varnish 上缓存对象,但告诉客户端不要缓存它

php - 防止在 CloudFlare 中缓存