idnits 2.17.1 draft-ietf-httpbis-cache-header-09.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (8 July 2021) is 1016 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-semantics-16 -- Possible downref: Normative reference to a draft: ref. 'I-D.ietf-httpbis-semantics' == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-16 -- Possible downref: Normative reference to a draft: ref. 'I-D.ietf-httpbis-cache' Summary: 0 errors (**), 0 flaws (~~), 3 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTP M. Nottingham 3 Internet-Draft Fastly 4 Intended status: Standards Track 8 July 2021 5 Expires: 9 January 2022 7 The Cache-Status HTTP Response Header Field 8 draft-ietf-httpbis-cache-header-09 10 Abstract 12 To aid debugging, HTTP caches often append header fields to a 13 response explaining how they handled the request. This specification 14 codifies that practice and updates it to align with HTTP's current 15 caching model. 17 Note to Readers 19 _RFC EDITOR: please remove this section before publication_ 21 Discussion of this draft takes place on the HTTP working group 22 mailing list (ietf-http-wg@w3.org), which is archived at 23 https://lists.w3.org/Archives/Public/ietf-http-wg/ 24 (https://lists.w3.org/Archives/Public/ietf-http-wg/). 26 Working Group information can be found at https://httpwg.org/ 27 (https://httpwg.org/); source code and issues list for this draft can 28 be found at https://github.com/httpwg/http-extensions/labels/cache- 29 header (https://github.com/httpwg/http-extensions/labels/cache- 30 header). 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at https://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on 9 January 2022. 49 Copyright Notice 51 Copyright (c) 2021 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 56 license-info) in effect on the date of publication of this document. 57 Please review these documents carefully, as they describe your rights 58 and restrictions with respect to this document. Code Components 59 extracted from this document must include Simplified BSD License text 60 as described in Section 4.e of the Trust Legal Provisions and are 61 provided without warranty as described in the Simplified BSD License. 63 Table of Contents 65 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 66 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 67 2. The Cache-Status HTTP Response Header Field . . . . . . . . . 3 68 2.1. The hit parameter . . . . . . . . . . . . . . . . . . . . 4 69 2.2. The fwd parameter . . . . . . . . . . . . . . . . . . . . 4 70 2.3. The fwd-status parameter . . . . . . . . . . . . . . . . 5 71 2.4. The ttl parameter . . . . . . . . . . . . . . . . . . . . 5 72 2.5. The stored parameter . . . . . . . . . . . . . . . . . . 6 73 2.6. The collapsed parameter . . . . . . . . . . . . . . . . . 6 74 2.7. The key parameter . . . . . . . . . . . . . . . . . . . . 6 75 2.8. The detail parameter . . . . . . . . . . . . . . . . . . 6 76 3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 6 77 4. Defining New Cache-Status Parameters . . . . . . . . . . . . 7 78 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 79 6. Security Considerations . . . . . . . . . . . . . . . . . . . 8 80 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 9 81 7.1. Normative References . . . . . . . . . . . . . . . . . . 9 82 7.2. Informative References . . . . . . . . . . . . . . . . . 10 83 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 10 85 1. Introduction 87 To aid debugging, HTTP caches often append header fields to a 88 response explaining how they handled the request. Unfortunately, the 89 semantics of these headers are often unclear, and both the semantics 90 and syntax used vary between implementations. 92 This specification defines a new HTTP response header field, "Cache- 93 Status" for this purpose. 95 1.1. Notational Conventions 97 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 98 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 99 "OPTIONAL" in this document are to be interpreted as described in BCP 100 14 [RFC2119] [RFC8174] when, and only when, they appear in all 101 capitals, as shown here. 103 This document uses ABNF as defined in [RFC5234]. 105 2. The Cache-Status HTTP Response Header Field 107 The Cache-Status HTTP response header field indicates caches' 108 handling of the request corresponding to the response it occurs 109 within. 111 Its value is a List ([RFC8941], Section 3.1): 113 Cache-Status = sf-list 115 Each member of the list represents a cache that has handled the 116 request. The first member of the list represents the cache closest 117 to the origin server, and the last member of the list represents the 118 cache closest to the user (possibly including the user agent's cache 119 itself, if it appends a value). 121 The Cache-Status header field is only applicable to responses that 122 have been generated by an origin server. An intermediary SHOULD NOT 123 append a Cache-Status member to responses that it generates, even if 124 that intermediary contains a cache, except when the generated 125 response is based upon a stored response (e.g., a 304 Not Modified or 126 206 Partial Content). 128 Caches determine when it is appropriate to add the Cache-Status 129 header field to a response. Some might add it to all responses, 130 whereas others might only do so when specifically configured to, or 131 when the request contains a header field that activates a debugging 132 mode. 134 When adding a value to the Cache-Status header field, caches SHOULD 135 preserve the existing field value, to allow debugging of the entire 136 chain of caches handling the request. 138 Each list member identifies the cache that inserted it and MUST be a 139 String or Token. Depending on the deployment, this might be a 140 product or service name (e.g., ExampleCache or "Example CDN"), a 141 hostname ("cache-3.example.com"), an IP address, or a generated 142 string. 144 Each member of the list can have parameters that describe that 145 cache's handling of the request. While these parameters are 146 OPTIONAL, caches are encouraged to provide as much information as 147 possible. 149 This specification defines the following parameters: 151 hit = sf-boolean 152 fwd = sf-token 153 fwd-status = sf-integer 154 ttl = sf-integer 155 stored = sf-boolean 156 collapsed = sf-boolean 157 key = sf-string 158 detail = sf-token / sf-string 160 2.1. The hit parameter 162 "hit", when true, indicates that the request was satisfied by the 163 cache; i.e., it was not forwarded, and the response was obtained from 164 the cache. 166 A response that was originally produced by the origin but was 167 modified by the cache (for example, a 304 or 206 status code) is 168 still considered a hit, as long as it did not go forward (e.g., for 169 validation). 171 A response that was in cache but not able to be used without going 172 forward (e.g., because it was stale, or partial) is not considered a 173 hit. Note that a stale response that is used without going forward 174 (e.g., because the origin server is not available) can be considered 175 a hit. 177 "hit" and "fwd" are exclusive; only one of them should appear on each 178 list member. 180 2.2. The fwd parameter 182 "fwd" indicates that the request went forward towards the origin, and 183 why. 185 The following parameter values are defined to explain why the request 186 went forward, from most specific to least: 188 * bypass - The cache was configured to not handle this request 190 * method - The request method's semantics require the request to be 191 forwarded 193 * uri-miss - The cache did not contain any responses that matched 194 the request URI 196 * vary-miss - The cache contained a response that matched the 197 request URI, but could not select a response based upon this 198 request's headers and stored Vary headers. 200 * miss - The cache did not contain any responses that could be used 201 to satisfy this request (to be used when an implementation cannot 202 distinguish between uri-miss and vary-miss) 204 * request - The cache was able to select a fresh response for the 205 request, but the request's semantics (e.g., Cache-Control request 206 directives) did not allow its use 208 * stale - The cache was able to select a response for the request, 209 but it was stale 211 * partial - The cache was able to select a partial response for the 212 request, but it did not contain all of the requested ranges (or 213 the request was for the complete response) 215 The most specific reason that the cache is aware of SHOULD be used. 216 See also [I-D.ietf-httpbis-semantics], Section 4. 218 2.3. The fwd-status parameter 220 "fwd-status" indicates what status code (see 221 [I-D.ietf-httpbis-semantics], Section 15) the next hop server 222 returned in response to the request. Only meaningful when "fwd" is 223 present; if "fwd-status" is not present but "fwd" is, it defaults to 224 the status code sent in the response. 226 This parameter is useful to distinguish cases when the next hop 227 server sends a 304 Not Modified response to a conditional request, or 228 a 206 Partial Response because of a range request. 230 2.4. The ttl parameter 232 "ttl" indicates the response's remaining freshness lifetime (see 233 [I-D.ietf-httpbis-cache], Section 4.2.1) as calculated by the cache, 234 as an integer number of seconds, measured when the response header 235 section is sent by the cache. This includes freshness assigned by 236 the cache; e.g., through heuristics (see [I-D.ietf-httpbis-cache], 237 Section 4.2.2), local configuration, or other factors. May be 238 negative, to indicate staleness. 240 2.5. The stored parameter 242 "stored" indicates whether the cache stored the response (see 243 [I-D.ietf-httpbis-cache], Section 3); a true value indicates that it 244 did. Only meaningful when fwd is present. 246 2.6. The collapsed parameter 248 "collapsed" indicates whether this request was collapsed together 249 with one or more other forward requests (see 250 [I-D.ietf-httpbis-cache], Section 4); if true, the response was 251 successfully reused; if not, a new request had to be made. If not 252 present, the request was not collapsed with others. Only meaningful 253 when fwd is present. 255 2.7. The key parameter 257 "key" conveys a representation of the cache key (see 258 [I-D.ietf-httpbis-cache], Section 2) used for the response. Note 259 that this may be implementation-specific. 261 2.8. The detail parameter 263 "detail" allows implementations to convey additional information not 264 captured in other parameters; for example, implementation-specific 265 states, or other caching-related metrics. 267 For example: 269 Cache-Status: ExampleCache; hit; detail=MEMORY 271 The semantics of a detail parameter are always specific to the cache 272 that sent it; even if a member of details from another cache shares 273 the same name, it might not mean the same thing. 275 This parameter is intentionally limited. If an implementation's 276 developer or operator needs to convey additional information in an 277 interoperable fashion, they are encouraged to register extension 278 parameters (see Section 4) or define another header field. 280 3. Examples 282 The most minimal cache hit: 284 Cache-Status: ExampleCache; hit 286 ... but a polite cache will give some more information, e.g.: 288 Cache-Status: ExampleCache; hit; ttl=376 290 A stale hit just has negative freshness: 292 Cache-Status: ExampleCache; hit; ttl=-412 294 Whereas a complete miss is: 296 Cache-Status: ExampleCache; fwd=uri-miss 298 A miss that successfully validated on the back-end server: 300 Cache-Status: ExampleCache; fwd=stale; fwd-status=304 302 A miss that was collapsed with another request: 304 Cache-Status: ExampleCache; fwd=uri-miss; collapsed 306 A miss that the cache attempted to collapse, but couldn't: 308 Cache-Status: ExampleCache; fwd=uri-miss; collapsed=?0 310 Going through two separate layers of caching, where the cache closest 311 to the origin responded to an earlier request with a stored response, 312 and a second cache stored that response and later reused it to 313 satisfy the current request: 315 Cache-Status: OriginCache; hit; ttl=1100, 316 "CDN Company Here"; hit; ttl=545 318 4. Defining New Cache-Status Parameters 320 New Cache-Status Parameters can be defined by registering them in the 321 HTTP Cache-Status Parameters registry. 323 Registration requests are reviewed and approved by a Designated 324 Expert, as per [RFC8126], Section 4.5. A specification document is 325 appreciated, but not required. 327 The Expert(s) should consider the following factors when evaluating 328 requests: 330 * Community feedback 332 * If the value is sufficiently well-defined 333 * Generic parameters are preferred over vendor-specific, 334 application-specific, or deployment-specific values. If a generic 335 value cannot be agreed upon in the community, the parameter's name 336 should be correspondingly specific (e.g., with a prefix that 337 identifies the vendor, application or deployment). 339 Registration requests should use the following template: 341 * Name: [a name for the Cache-Status Parameter that matches key] 343 * Description: [a description of the parameter semantics and value] 345 * Reference: [to a specification defining this parameter] 347 See the registry at https://iana.org/assignments/http-cache-status 348 (https://iana.org/assignments/http-cache-status) for details on where 349 to send registration requests. 351 5. IANA Considerations 353 Upon publication, please create the HTTP Cache-Status Parameters 354 registry at https://iana.org/assignments/http-cache-status 355 (https://iana.org/assignments/http-cache-status) and populate it with 356 the types defined in Section 2; see Section 4 for its associated 357 procedures. 359 Also, please create the following entry in the Hypertext Transfer 360 Protocol (HTTP) Field Name Registry defined in 361 [I-D.ietf-httpbis-semantics], Section 18.4: 363 * Field name: Cache-Status 365 * Status: permanent 367 * Specification document: [this document] 369 * Comments: 371 6. Security Considerations 373 Attackers can use the information in Cache-Status to probe the 374 behaviour of the cache (and other components), and infer the activity 375 of those using the cache. The Cache-Status header field may not 376 create these risks on its own, but can assist attackers in exploiting 377 them. 379 For example, knowing if a cache has stored a response can help an 380 attacker execute a timing attack on sensitive data. Exposing the 381 cache key can help an attacker understand modifications to the cache 382 key, which may assist cache poisoning attacks. See [ENTANGLE] for 383 details. 385 The underlying risks can be mitigated with a variety of techniques 386 (e.g., use of encryption and authentication; avoiding the inclusion 387 of attacker-controlled data in the cache key), depending on their 388 exact nature. 390 To avoid assisting such attacks, the Cache-Status header field can be 391 omitted, only sent when the client is authorized to receive it, or 392 only send sensitive information (e.g., the key parameter) when the 393 client is authorized. 395 7. References 397 7.1. Normative References 399 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 400 Requirement Levels", BCP 14, RFC 2119, 401 DOI 10.17487/RFC2119, March 1997, 402 . 404 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 405 Writing an IANA Considerations Section in RFCs", BCP 26, 406 RFC 8126, DOI 10.17487/RFC8126, June 2017, 407 . 409 [RFC8941] Nottingham, M. and P-H. Kamp, "Structured Field Values for 410 HTTP", RFC 8941, DOI 10.17487/RFC8941, February 2021, 411 . 413 [I-D.ietf-httpbis-semantics] 414 Fielding, R. T., Nottingham, M., and J. Reschke, "HTTP 415 Semantics", Work in Progress, Internet-Draft, draft-ietf- 416 httpbis-semantics-16, 27 May 2021, 417 . 420 [I-D.ietf-httpbis-cache] 421 Fielding, R. T., Nottingham, M., and J. Reschke, "HTTP 422 Caching", Work in Progress, Internet-Draft, draft-ietf- 423 httpbis-cache-16, 27 May 2021, 424 . 427 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 428 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 429 May 2017, . 431 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 432 Specifications: ABNF", STD 68, RFC 5234, 433 DOI 10.17487/RFC5234, January 2008, 434 . 436 7.2. Informative References 438 [ENTANGLE] Kettle, J., "Web Cache Entanglement: Novel Pathways to 439 Poisoning", 2020, . 443 Author's Address 445 Mark Nottingham 446 Fastly 447 Prahran VIC 448 Australia 450 Email: mnot@mnot.net 451 URI: https://www.mnot.net/