Cache-Control官方文档

本文详细介绍了HTTP协议中Cache-Control头字段的作用及其指令如何沿请求/响应链传递。文章解释了缓存指令的单向特性,并强调了代理服务器在转发消息时必须传递缓存指令的要求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://tools.ietf.org/html/draft-ietf-httpbis-p6-cache-25#page-21

 

5.2. Cache-Control



   The "Cache-Control" header field is used to specify directives for
   caches along the request/response chain.  Such cache directives are
   unidirectional in that the presence of a directive in a request does
   not imply that the same directive is to be given in the response.

   A cache MUST obey the requirements of the Cache-Control directives
   defined in this section.  See Section 5.2.3 for information about how
   Cache-Control directives defined elsewhere are handled.

      Note: Some HTTP/1.0 caches might not implement Cache-Control.

   A proxy, whether or not it implements a cache, MUST pass cache
   directives through in forwarded messages, regardless of their
   significance to that application, since the directives might be
   applicable to all recipients along the request/response chain.  It is
   not possible to target a directive to a specific cache.

   Cache directives are identified by a token, to be compared case-
   insensitively, and have an optional argument, that can use both token
   and quoted-string syntax.  For the directives defined below that
   define arguments, recipients ought to accept both forms, even if one
   is documented to be preferred.  For any directive not defined by this
   specification, a recipient MUST accept both forms.

     Cache-Control   = 1#cache-directive

     cache-directive = token [ "=" ( token / quoted-string ) ]

   For the cache directives defined below, no argument is defined (nor
   allowed) unless stated otherwise.

5.2.1. Request Cache-Control Directives
5.2.1.1. max-age


   Argument syntax:

      delta-seconds (see Section 1.2.1)

   The "max-age" request directive indicates that the client is
   unwilling to accept a response whose age is greater than the
   specified number of seconds.  Unless the max-stale request directive
   is also present, the client is not willing to accept a stale
   response.

   This directive uses the token form of the argument syntax; e.g.,



Fielding, et al.          Expires May 21, 2014                 [Page 21]


Internet-Draft              HTTP/1.1 Caching               November 2013


   'max-age=5', not 'max-age="5"'.  A sender SHOULD NOT generate the
   quoted-string form.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值