idnits 2.17.1 draft-ietf-httpbis-cache-header-10.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 (17 August 2021) is 983 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-17 -- Possible downref: Normative reference to a draft: ref. 'HTTP' == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-17 -- Possible downref: Normative reference to a draft: ref. 'HTTP-CACHING' 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 17 August 2021 5 Expires: 18 February 2022 7 The Cache-Status HTTP Response Header Field 8 draft-ietf-httpbis-cache-header-10 10 Abstract 12 To aid debugging, HTTP caches often append header fields to a 13 response explaining how they handled the request in an ad hoc manner. 14 This specification defines a standard mechanism to do so that is 15 aligned with HTTP's 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 18 February 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 . . . . . . . . . . . . . . . . . . . . 6 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 . . . . . . . . . . . . . . . . . . . . . . . . . . 7 77 4. Defining New Cache-Status Parameters . . . . . . . . . . . . 8 78 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 79 6. Security Considerations . . . . . . . . . . . . . . . . . . . 9 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 (both by humans and automated tools), HTTP caches 88 often append header fields to a response explaining how they handled 89 the request. Unfortunately, the semantics of these headers are often 90 unclear, and both the semantics and syntax used vary between 91 implementations. 93 This specification defines a new HTTP response header field, "Cache- 94 Status" for this purpose, with standardized syntax and semantics. 96 1.1. Notational Conventions 98 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 99 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 100 "OPTIONAL" in this document are to be interpreted as described in BCP 101 14 [RFC2119] [RFC8174] when, and only when, they appear in all 102 capitals, as shown here. 104 This document uses ABNF as defined in [RFC5234], with rules prefixed 105 with "sf-" and the "key" rule as defined in [STRUCTURED-FIELDS]. It 106 uses terminology from [HTTP] and [HTTP-CACHING]. 108 2. The Cache-Status HTTP Response Header Field 110 The Cache-Status HTTP response header field indicates how caches have 111 handled that response and its corresponding request. The syntax of 112 this header field conforms to [STRUCTURED-FIELDS]. 114 Its value is a List ([STRUCTURED-FIELDS], Section 3.1): 116 Cache-Status = sf-list 118 Each member of the list represents a cache that has handled the 119 request. The first member of the list represents the cache closest 120 to the origin server, and the last member of the list represents the 121 cache closest to the user (possibly including the user agent's cache 122 itself, if it appends a value). 124 Caches determine when it is appropriate to add the Cache-Status 125 header field to a response. Some might add it to all responses, 126 whereas others might only do so when specifically configured to, or 127 when the request contains a header field that activates a debugging 128 mode. See Section 6 for related security considerations. 130 An intermediary SHOULD NOT append a Cache-Status member to responses 131 that it generates locally, even if that intermediary contains a 132 cache, unless the generated response is based upon a stored response 133 (e.g., 304 Not Modified and 206 Partial Content are both based upon a 134 stored response). For example, a proxy generating a 400 response due 135 to a malformed request will not add a Cache-Status value, because 136 that response was generated by the proxy, not the origin server. 138 When adding a value to the Cache-Status header field, caches SHOULD 139 preserve the existing field value, to allow debugging of the entire 140 chain of caches handling the request. 142 Each list member identifies the cache that inserted it and this 143 identifier MUST be a String or Token. Depending on the deployment, 144 this might be a product or service name (e.g., ExampleCache or 145 "Example CDN"), a hostname ("cache-3.example.com"), an IP address, or 146 a generated string. 148 Each member of the list can have parameters that describe that 149 cache's handling of the request. While these parameters are 150 OPTIONAL, caches are encouraged to provide as much information as 151 possible. 153 This specification defines the following parameters: 155 hit = sf-boolean 156 fwd = sf-token 157 fwd-status = sf-integer 158 ttl = sf-integer 159 stored = sf-boolean 160 collapsed = sf-boolean 161 key = sf-string 162 detail = sf-token / sf-string 164 2.1. The hit parameter 166 "hit", when true, indicates that the request was satisfied by the 167 cache; i.e., it was not forwarded, and the response was obtained from 168 the cache. 170 A response that was originally produced by the origin but was 171 modified by the cache (for example, a 304 or 206 status code) is 172 still considered a hit, as long as it did not go forward (e.g., for 173 validation). 175 A response that was in cache but not able to be used without going 176 forward (e.g., because it was stale, or partial) is not considered a 177 hit. Note that a stale response that is used without going forward 178 (e.g., because the origin server is not available) can be considered 179 a hit. 181 "hit" and "fwd" are exclusive; only one of them should appear on each 182 list member. 184 2.2. The fwd parameter 186 "fwd" indicates that the request went forward towards the origin, and 187 why. 189 The following parameter values are defined to explain why the request 190 went forward, from most specific to least: 192 * bypass - The cache was configured to not handle this request 194 * method - The request method's semantics require the request to be 195 forwarded 197 * uri-miss - The cache did not contain any responses that matched 198 the request URI 200 * vary-miss - The cache contained a response that matched the 201 request URI, but could not select a response based upon this 202 request's headers and stored Vary headers. 204 * miss - The cache did not contain any responses that could be used 205 to satisfy this request (to be used when an implementation cannot 206 distinguish between uri-miss and vary-miss) 208 * request - The cache was able to select a fresh response for the 209 request, but the request's semantics (e.g., Cache-Control request 210 directives) did not allow its use 212 * stale - The cache was able to select a response for the request, 213 but it was stale 215 * partial - The cache was able to select a partial response for the 216 request, but it did not contain all of the requested ranges (or 217 the request was for the complete response) 219 The most specific reason that the cache is aware of SHOULD be used, 220 to the extent that it is possible to implement. See also 221 [HTTP-CACHING], Section 4. 223 2.3. The fwd-status parameter 225 "fwd-status" indicates what status code (see [HTTP], Section 15) the 226 next hop server returned in response to the forwarded request. Only 227 meaningful when "fwd" is present; if "fwd-status" is not present but 228 "fwd" is, it defaults to the status code sent in the response. 230 This parameter is useful to distinguish cases when the next hop 231 server sends a 304 Not Modified response to a conditional request, or 232 a 206 Partial Response because of a range request. 234 2.4. The ttl parameter 236 "ttl" indicates the response's remaining freshness lifetime (see 237 [HTTP-CACHING], Section 4.2.1) as calculated by the cache, as an 238 integer number of seconds, measured as closely as possible to when 239 the response header section is sent by the cache. This includes 240 freshness assigned by the cache; e.g., through heuristics (see 241 [HTTP-CACHING], Section 4.2.2), local configuration, or other 242 factors. May be negative, to indicate staleness. 244 2.5. The stored parameter 246 "stored" indicates whether the cache stored the response (see 247 [HTTP-CACHING], Section 3); a true value indicates that it did. Only 248 meaningful when fwd is present. 250 2.6. The collapsed parameter 252 "collapsed" indicates whether this request was collapsed together 253 with one or more other forward requests (see [HTTP-CACHING], 254 Section 4); if true, the response was successfully reused; if not, a 255 new request had to be made. If not present, the request was not 256 collapsed with others. Only meaningful when fwd is present. 258 2.7. The key parameter 260 "key" conveys a representation of the cache key (see [HTTP-CACHING], 261 Section 2) used for the response. Note that this may be 262 implementation-specific. 264 2.8. The detail parameter 266 "detail" allows implementations to convey additional information not 267 captured in other parameters; for example, implementation-specific 268 states, or other caching-related metrics. 270 For example: 272 Cache-Status: ExampleCache; hit; detail=MEMORY 274 The semantics of a detail parameter are always specific to the cache 275 that sent it; even if a member of details from another cache shares 276 the same name, it might not mean the same thing. 278 This parameter is intentionally limited. If an implementation's 279 developer or operator needs to convey additional information in an 280 interoperable fashion, they are encouraged to register extension 281 parameters (see Section 4) or define another header field. 283 3. Examples 285 The most minimal cache hit: 287 Cache-Status: ExampleCache; hit 289 ... but a polite cache will give some more information, e.g.: 291 Cache-Status: ExampleCache; hit; ttl=376 293 A stale hit just has negative freshness: 295 Cache-Status: ExampleCache; hit; ttl=-412 297 Whereas a complete miss is: 299 Cache-Status: ExampleCache; fwd=uri-miss 301 A miss that successfully validated on the back-end server: 303 Cache-Status: ExampleCache; fwd=stale; fwd-status=304 305 A miss that was collapsed with another request: 307 Cache-Status: ExampleCache; fwd=uri-miss; collapsed 309 A miss that the cache attempted to collapse, but couldn't: 311 Cache-Status: ExampleCache; fwd=uri-miss; collapsed=?0 313 Going through two separate layers of caching, where the cache closest 314 to the origin responded to an earlier request with a stored response, 315 and a second cache stored that response and later reused it to 316 satisfy the current request: 318 Cache-Status: OriginCache; hit; ttl=1100, 319 "CDN Company Here"; hit; ttl=545 321 Going through a three-layer caching system, where the closest to the 322 origin is a reverse proxy (where the response was served from cache), 323 the next is a forward proxy interposed by the network (where the 324 request was forwarded because there wasn't any response cached with 325 its URI, the request was collapsed with others, and the resulting 326 response was stored), and the closest to the user is a browser cache 327 (where there wasn't any response cached with the request's URI): 329 Cache-Status: ReverseProxyCache; hit 330 Cache-Status: ForwardProxyCache; fwd=uri-miss; collapsed; stored 331 Cache-Status: BrowserCache; fwd=uri-miss 333 4. Defining New Cache-Status Parameters 335 New Cache-Status Parameters can be defined by registering them in the 336 HTTP Cache-Status Parameters registry. 338 Registration requests are reviewed and approved by a Designated 339 Expert, as per [RFC8126], Section 4.5. A specification document is 340 appreciated, but not required. 342 The Expert(s) should consider the following factors when evaluating 343 requests: 345 * Community feedback 347 * If the value is sufficiently well-defined 349 * Generic parameters are preferred over vendor-specific, 350 application-specific, or deployment-specific values. If a generic 351 value cannot be agreed upon in the community, the parameter's name 352 should be correspondingly specific (e.g., with a prefix that 353 identifies the vendor, application or deployment). 355 Registration requests should use the following template: 357 * Name: [a name for the Cache-Status Parameter that matches the 358 'key' ABNF rule] 360 * Description: [a description of the parameter semantics and value] 362 * Reference: [to a specification defining this parameter, if 363 available] 365 See the registry at https://iana.org/assignments/http-cache-status 366 (https://iana.org/assignments/http-cache-status) for details on where 367 to send registration requests. 369 5. IANA Considerations 371 Upon publication, please create the HTTP Cache-Status Parameters 372 registry at https://iana.org/assignments/http-cache-status 373 (https://iana.org/assignments/http-cache-status) and populate it with 374 the types defined in Section 2; see Section 4 for its associated 375 procedures. 377 Also, please create the following entry in the Hypertext Transfer 378 Protocol (HTTP) Field Name Registry defined in [HTTP], Section 18.4: 380 * Field name: Cache-Status 382 * Status: permanent 384 * Specification document: [this document] 386 * Comments: 388 6. Security Considerations 390 Attackers can use the information in Cache-Status to probe the 391 behaviour of the cache (and other components), and infer the activity 392 of those using the cache. The Cache-Status header field may not 393 create these risks on its own, but can assist attackers in exploiting 394 them. 396 For example, knowing if a cache has stored a response can help an 397 attacker execute a timing attack on sensitive data. 399 Additionally, exposing the cache key can help an attacker understand 400 modifications to the cache key, which may assist cache poisoning 401 attacks. See [ENTANGLE] for details. 403 The underlying risks can be mitigated with a variety of techniques 404 (e.g., use of encryption and authentication; avoiding the inclusion 405 of attacker-controlled data in the cache key), depending on their 406 exact nature. Note that merely obfuscating the key does not mitigate 407 this risk. 409 To avoid assisting such attacks, the Cache-Status header field can be 410 omitted, only sent when the client is authorized to receive it, or 411 only send sensitive information (e.g., the key parameter) when the 412 client is authorized. 414 7. References 416 7.1. Normative References 418 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 419 Requirement Levels", BCP 14, RFC 2119, 420 DOI 10.17487/RFC2119, March 1997, 421 . 423 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 424 Writing an IANA Considerations Section in RFCs", BCP 26, 425 RFC 8126, DOI 10.17487/RFC8126, June 2017, 426 . 428 [STRUCTURED-FIELDS] 429 Nottingham, M. and P-H. Kamp, "Structured Field Values for 430 HTTP", RFC 8941, DOI 10.17487/RFC8941, February 2021, 431 . 433 [HTTP] Fielding, R. T., Nottingham, M., and J. Reschke, "HTTP 434 Semantics", Work in Progress, Internet-Draft, draft-ietf- 435 httpbis-semantics-17, 25 July 2021, 436 . 439 [HTTP-CACHING] 440 Fielding, R. T., Nottingham, M., and J. Reschke, "HTTP 441 Caching", Work in Progress, Internet-Draft, draft-ietf- 442 httpbis-cache-17, 25 July 2021, 443 . 446 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 447 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 448 May 2017, . 450 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 451 Specifications: ABNF", STD 68, RFC 5234, 452 DOI 10.17487/RFC5234, January 2008, 453 . 455 7.2. Informative References 457 [ENTANGLE] Kettle, J., "Web Cache Entanglement: Novel Pathways to 458 Poisoning", 2020, . 462 Author's Address 464 Mark Nottingham 465 Fastly 466 Prahran VIC 467 Australia 469 Email: mnot@mnot.net 470 URI: https://www.mnot.net/