idnits 2.17.1 draft-ietf-httpbis-cache-header-07.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 (26 January 2021) is 1184 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) No issues found here. Summary: 0 errors (**), 0 flaws (~~), 1 warning (==), 1 comment (--). 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 26 January 2021 5 Expires: 30 July 2021 7 The Cache-Status HTTP Response Header Field 8 draft-ietf-httpbis-cache-header-07 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 30 July 2021. 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 Proxy-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 . . . . . . . . . . . . . . . . . 9 83 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 9 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], along with the "%s" 104 extension for case sensitivity defined in [RFC7405]. 106 2. The Cache-Status HTTP Response Header Field 108 The Cache-Status HTTP response header field indicates caches' 109 handling of the request corresponding to the response it occurs 110 within. 112 Its value is a List [I-D.ietf-httpbis-header-structure], Section 3.1: 114 Cache-Status = sf-list 116 Each member of the list represents a cache that has handled the 117 request. The first member of the list represents the cache closest 118 to the origin server, and the last member of the list represents the 119 cache closest to the user (possibly including the user agent's cache 120 itself, if it appends a value). 122 The Cache-Status header field is only applicable to responses that 123 are generated by an origin server. An intermediary SHOULD NOT append 124 a Cache-Status member to responses that it generates, even if that 125 intermediary contains a cache, except when the generated response is 126 based upon a stored response (e.g., a 304 Not Modified or 206 Partial 127 Content). 129 Caches determine when it is appropriate to add the Cache-Status 130 header field to a response. Some might add it to all responses, 131 whereas others might only do so when specifically configured to, or 132 when the request contains a header field that activates a debugging 133 mode. 135 When adding a value to the Cache-Status header field, caches SHOULD 136 preserve the existing field value, to allow debugging of the entire 137 chain of caches handling the request. 139 Each list member identifies the cache that inserted it and MUST be a 140 String or Token. Depending on the deployment, this might be a 141 product or service name (e.g., ExampleCache or "Example CDN"), a 142 hostname ("cache-3.example.com"), an IP address, or a generated 143 string. 145 Each member of the list can have parameters that describe that 146 cache's handling of the request. While these parameters are 147 OPTIONAL, caches are encouraged to provide as much information as 148 possible. 150 This specification defines the following parameters: 152 hit = sf-boolean 153 fwd = sf-token 154 fwd-status = sf-integer 155 ttl = sf-integer 156 stored = sf-boolean 157 collapsed = sf-boolean 158 key = sf-string 159 detail = sf-token / sf-string 161 2.1. The hit parameter 163 "hit", when true, indicates that the request was satisfied by the 164 cache; i.e., it was not forwarded, and the response was obtained from 165 the cache. 167 A response that was originally produced by the origin but was 168 modified by the cache (for example, a 304 or 206 status code) is 169 still considered a hit, as long as it did not go forward (e.g., for 170 validation). 172 A response that was in cache but not able to be used without going 173 forward (e.g., because it was stale, or partial) is not considered a 174 hit. Note that a stale response that is used without going forward 175 (e.g., because the origin server is not available) can be considered 176 a hit. 178 "hit" and "fwd" are exclusive; only one of them should appear on each 179 list member. 181 2.2. The fwd parameter 183 "fwd" indicates that the request went forward towards the origin, and 184 why. 186 The following parameter values are defined to explain why the request 187 went forward, from most specific to least: 189 * bypass - The cache was configured to not handle this request 191 * method - The request method's semantics require the request to be 192 forwarded 194 * uri-miss - The cache did not contain any responses that matched 195 the request URI 197 * vary-miss - The cache contained a response that matched the 198 request URI, but could not select a response based upon this 199 request's headers and stored Vary headers. 201 * miss - The cache did not contain any responses that could be used 202 to satisfy this request (to be used when an implementation cannot 203 distinguish between uri-miss and vary-miss) 205 * request - The cache was able to select a fresh response for the 206 request, but the request's semantics (e.g., Cache-Control request 207 directives) did not allow its use 209 * stale - The cache was able to select a response for the request, 210 but it was stale 212 * partial - The cache was able to select a partial response for the 213 request, but it did not contain all of the requested ranges (or 214 the request was for the complete response) 216 The most specific reason that the cache is aware of SHOULD be used. 218 2.3. The fwd-status parameter 220 "fwd-status" indicates what status code the next hop server returned 221 in response to the request. Only meaningful when "fwd" is present; 222 if "fwd-status" is not present but "fwd" is, it defaults to the 223 status code sent in the response. 225 This parameter is useful to distinguish cases when the next hop 226 server sends a 304 Not Modified response to a conditional request, or 227 a 206 Partial Response because of a range request. 229 2.4. The ttl parameter 231 "ttl" indicates the response's remaining freshness lifetime as 232 calculated by the cache, as an integer number of seconds, measured 233 when the response header section is sent by the cache. This includes 234 freshness assigned by the cache; e.g., through heuristics, local 235 configuration, or other factors. May be negative, to indicate 236 staleness. 238 2.5. The stored parameter 240 "stored" indicates whether the cache stored the response; a true 241 value indicates that it did. Only meaningful when fwd is present. 243 2.6. The collapsed parameter 245 "collapsed" indicates whether this request was collapsed together 246 with one or more other forward requests; if true, the response was 247 successfully reused; if not, a new request had to be made. If not 248 present, the request was not collapsed with others. Only meaningful 249 when fwd is present. 251 2.7. The key parameter 253 "key" conveys a representation of the cache key used for the 254 response. Note that this may be implementation-specific. 256 2.8. The detail parameter 258 "detail" allows implementations to convey additional information not 259 captured in other parameters; for example, implementation-specific 260 states, or other caching-related metrics. 262 For example: 264 Cache-Status: ExampleCache; hit; detail=MEMORY 266 The semantics of a detail parameter are always specific to the cache 267 that sent it; even if a member of details from another cache shares 268 the same name, it might not mean the same thing. 270 This parameter is intentionally limited. If an implementation's 271 developer or operator needs to convey additional information in an 272 interoperable fashion, they are encouraged to register extension 273 parameters (see Section 4) or define another header field. 275 3. Examples 277 The most minimal cache hit: 279 Cache-Status: ExampleCache; hit 281 ... but a polite cache will give some more information, e.g.: 283 Cache-Status: ExampleCache; hit; ttl=376 285 A stale hit just has negative freshness: 287 Cache-Status: ExampleCache; hit; ttl=-412 289 Whereas a complete miss is: 291 Cache-Status: ExampleCache; fwd=uri-miss 293 A miss that successfully validated on the back-end server: 295 Cache-Status: ExampleCache; fwd=stale; fwd-status=304 297 A miss that was collapsed with another request: 299 Cache-Status: ExampleCache; fwd=uri-miss; collapsed 301 A miss that the cache attempted to collapse, but couldn't: 303 Cache-Status: ExampleCache; fwd=uri-miss; collapsed=?0 305 Going through two layers of caching, both of which were hits, and the 306 second collapsed with other requests: 308 Cache-Status: OriginCache; hit; ttl=1100; collapsed, 309 "CDN Company Here"; hit; ttl=545 311 4. Defining New Proxy-Status Parameters 313 New Cache-Status Parameters can be defined by registering them in the 314 HTTP Cache-Status Parameters registry. 316 Registration requests are reviewed and approved by a Designated 317 Expert, as per [RFC8126], Section 4.5. A specification document is 318 appreciated, but not required. 320 The Expert(s) should consider the following factors when evaluating 321 requests: 323 * Community feedback 325 * If the value is sufficiently well-defined 327 * Generic parameters are preferred over vendor-specific, 328 application-specific, or deployment-specific values. If a generic 329 value cannot be agreed upon in the community, the parameter's name 330 should be correspondingly specific (e.g., with a prefix that 331 identifies the vendor, application or deployment). 333 Registration requests should use the following template: 335 * Name: [a name for the Cache-Status Parameter that matches key] 337 * Description: [a description of the parameter semantics and value] 339 * Reference: [to a specification defining this parameter] 341 See the registry at https://iana.org/assignments/http-cache-status 342 (https://iana.org/assignments/http-cache-status) for details on where 343 to send registration requests. 345 5. IANA Considerations 347 Upon publication, please create the HTTP Cache-Status Parameters 348 registry at https://iana.org/assignments/http-cache-status 349 (https://iana.org/assignments/http-cache-status) and populate it with 350 the types defined in Section 2; see Section 4 for its associated 351 procedures. 353 6. Security Considerations 355 Attackers can use the information in Cache-Status to probe the 356 behaviour of the cache (and other components), and infer the activity 357 of those using the cache. The Cache-Status header field may not 358 create these risks on its own, but can assist attackers in exploiting 359 them. 361 For example, knowing if a cache has stored a response can help an 362 attacker execute a timing attack on sensitive data. Exposing the 363 cache key can help an attacker understand modifications to the cache 364 key, which may assist cache poisoning attacks. See [ENTANGLE] for 365 details. 367 The underlying risks can be mitigated with a variety of techniques 368 (e.g., use of encryption and authentication; avoiding the inclusion 369 of attacker-controlled data in the cache key), depending on their 370 exact nature. 372 To avoid assisting such attacks, the Cache-Status header field can be 373 omitted, only sent when the client is authorized to receive it, or 374 only send sensitive information (e.g., the key parameter) when the 375 client is authorized. 377 7. References 379 7.1. Normative References 381 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 382 Requirement Levels", BCP 14, RFC 2119, 383 DOI 10.17487/RFC2119, March 1997, 384 . 386 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 387 Writing an IANA Considerations Section in RFCs", BCP 26, 388 RFC 8126, DOI 10.17487/RFC8126, June 2017, 389 . 391 [I-D.ietf-httpbis-header-structure] 392 Nottingham, M. and P. Kamp, "Structured Field Values for 393 HTTP", Work in Progress, Internet-Draft, draft-ietf- 394 httpbis-header-structure-19, 3 June 2020, 395 . 398 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 399 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 400 May 2017, . 402 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 403 Specifications: ABNF", STD 68, RFC 5234, 404 DOI 10.17487/RFC5234, January 2008, 405 . 407 [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", 408 RFC 7405, DOI 10.17487/RFC7405, December 2014, 409 . 411 7.2. Informative References 413 [ENTANGLE] Kettle, J., "Web Cache Entanglement: Novel Pathways to 414 Poisoning", n.d., . 418 Author's Address 419 Mark Nottingham 420 Fastly 421 Prahran VIC 422 Australia 424 Email: mnot@mnot.net 425 URI: https://www.mnot.net/