http:   revalidate

在http头中可能会出现must-revalidate ; 以前没太注意,其大致意思为:
如果服务器端明确指出了资源的过期时间或者是保鲜时间,而且声明了资源的修改时间或者etag之类的标识,那么就有一个问题: 在保鲜时间内,如果用到了该资源,是不是要(根据修改时间或etag)到服务器确认一下资源是否最新的,如果没有明确说明,则agent有自己的默认机制,如果服务器声明了:must-revalidate, 则每次使用该资源就都需要确认资源新鲜性了。

相关参考: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4

must-revalidate
      Because a cache MAY be configured to ignore a server’s specified       expiration time, and because a client request MAY include a max-       stale directive (which has a similar effect), the protocol also       includes a mechanism for the origin server to require revalidation       of a cache entry on any subsequent use. When the must-revalidate       directive is present in a response received by a cache, that cache       MUST NOT use the entry after it becomes stale to respond to a
      subsequent request without first revalidating it with the origin       server. (I.e., the cache MUST do an end-to-end revalidation every       time, if, based solely on the origin server’s Expires or max-age       value, the cached response is stale.)
      The must-revalidate directive is necessary to support reliable       operation for certain protocol features. In all circumstances an       HTTP/1.1 cache MUST obey the must-revalidate directive; in       particular, if the cache cannot reach the origin server for any       reason, it MUST generate a 504 (Gateway Timeout) response.
      Servers SHOULD send the must-revalidate directive if and only if       failure to revalidate a request on the entity could result in       incorrect operation, such as a silently unexecuted financial       transaction. Recipients MUST NOT take any automated action that       violates this directive, and MUST NOT automatically provide an       unvalidated copy of the entity if revalidation fails.
      Although this is not recommended, user agents operating under       severe connectivity constraints MAY violate this directive but, if       so, MUST explicitly warn the user that an unvalidated response has       been provided. The warning MUST be provided on each unvalidated       access, and SHOULD require explicit user confirmation.
   proxy-revalidate
      The proxy-revalidate directive has the same meaning as the must-       revalidate directive, except that it does not apply to non-shared       user agent caches. It can be used on a response to an       authenticated request to permit the user’s cache to store and       later return the response without needing to revalidate it (since       it has already been authenticated once by that user), while still       requiring proxies that service many users to revalidate each time       (in order to make sure that each user has been authenticated).       Note that such authenticated responses also need the public cache       control directive in order to allow them to be cached at all.

留下评论

邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据