HTTP Cache Control max-age,必须重新验证 [英] HTTP Cache Control max-age, must-revalidate

查看:110
本文介绍了HTTP Cache Control max-age,必须重新验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个与Cache-Control相关的查询。

I have a couple of queries related to Cache-Control.

如果我指定Cache-Control max-age = 3600,则必须 - 对于静态html / js / images / css文件重新验证,在HTTP标头中定义了Last Modified Header:

If I specify Cache-Control max-age=3600, must-revalidate for a static html/js/images/css file, with Last Modified Header defined in HTTP header:


  1. 浏览器/代理缓存(如Squid / Akamai)是否一直到源服务器以在max-age到期之前验证 ?或者它会从缓存中提供内容直到max-age到期?

  2. 在max-age到期后(即从缓存到期),是否有If-Modified-Since检查或是内容re - 从原始服务器下载没有if-Modified-自检查?

  1. Does browser/proxy cache(like Squid/Akamai) go all the way to origin server to validate before max-age expires? Or will it serve content from cache till max-age expires?
  2. After max-age expiry (that is expiry from cache), is there a If-Modified-Since check or is content re-downloaded from origin server w/o If-Modified-Since check?


推荐答案

a)如果服务器包含此标头:

a) If the server includes this header:

Cache-Control "max-age=3600, must-revalidate"

它告诉客户端缓存和代理缓存,一旦内容过时(超过3600秒),它们必须重新验证原始服务器才能提供内容。这应该是缓存系统的默认行为,但必须重新验证指令使此要求明确无误。

it is telling both client caches and proxy caches that once the content is stale (older than 3600 seconds) they must revalidate at the origin server before they can serve the content. This should be the default behavior of caching systems, but the must-revalidate directive makes this requirement unambiguous.

b)客户应重新验证。它可能会使用带有ETag的 If-Match If-None-Match 标头重新验证,或者它可能会使用 If-Modified-Since If-Unmodified-Since 标题日期。

b) The client should revalidate. It might revalidate using the If-Match or If-None-Match headers with an ETag, or it might use the If-Modified-Since or If-Unmodified-Since headers with a date.

这篇关于HTTP Cache Control max-age,必须重新验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆