| < draft-ietf-httpbis-cache-header-00.txt | draft-ietf-httpbis-cache-header-01.txt > | |||
|---|---|---|---|---|
| HTTP Working Group M. Nottingham | HTTP M. Nottingham | |||
| Internet-Draft Fastly | Internet-Draft Fastly | |||
| Intended status: Standards Track January 27, 2019 | Intended status: Standards Track November 2, 2019 | |||
| Expires: July 31, 2019 | Expires: May 5, 2020 | |||
| The Cache HTTP Response Header | The Cache-Status HTTP Response Header | |||
| draft-ietf-httpbis-cache-header-00 | draft-ietf-httpbis-cache-header-01 | |||
| Abstract | Abstract | |||
| To aid debugging, HTTP caches often append headers to a response | To aid debugging, HTTP caches often append headers to a response | |||
| detailing how they handled the request. This specification codifies | detailing how they handled the request. This specification codifies | |||
| that practice and updates it for HTTP's current caching model. | that practice and updates it for HTTP's current caching model. | |||
| Note to Readers | Note to Readers | |||
| _RFC EDITOR: please remove this section before publication_ | _RFC EDITOR: please remove this section before publication_ | |||
| skipping to change at page 1, line 44 ¶ | skipping to change at page 1, line 44 ¶ | |||
| Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
| Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
| working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
| Drafts is at https://datatracker.ietf.org/drafts/current/. | Drafts is at https://datatracker.ietf.org/drafts/current/. | |||
| Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
| and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
| time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
| material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
| This Internet-Draft will expire on July 31, 2019. | This Internet-Draft will expire on May 5, 2020. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2019 IETF Trust and the persons identified as the | Copyright (c) 2019 IETF Trust and the persons identified as the | |||
| document authors. All rights reserved. | document authors. All rights reserved. | |||
| This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
| Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
| (https://trustee.ietf.org/license-info) in effect on the date of | (https://trustee.ietf.org/license-info) in effect on the date of | |||
| publication of this document. Please review these documents | publication of this document. Please review these documents | |||
| carefully, as they describe your rights and restrictions with respect | carefully, as they describe your rights and restrictions with respect | |||
| to this document. Code Components extracted from this document must | to this document. Code Components extracted from this document must | |||
| include Simplified BSD License text as described in Section 4.e of | include Simplified BSD License text as described in Section 4.e of | |||
| the Trust Legal Provisions and are provided without warranty as | the Trust Legal Provisions and are provided without warranty as | |||
| described in the Simplified BSD License. | described in the Simplified BSD License. | |||
| Table of Contents | Table of Contents | |||
| 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 | |||
| 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 | 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 | |||
| 2. The Cache HTTP Response Header . . . . . . . . . . . . . . . 3 | 2. The Cache-Status HTTP Response Header . . . . . . . . . . . . 3 | |||
| 3. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | 2.1. The fwd parameter . . . . . . . . . . . . . . . . . . . . 4 | |||
| 4. References . . . . . . . . . . . . . . . . . . . . . . . . . 6 | 2.2. The fwd-res parameter . . . . . . . . . . . . . . . . . . 4 | |||
| 4.1. Normative References . . . . . . . . . . . . . . . . . . 6 | 2.3. The fwd-stored parameter . . . . . . . . . . . . . . . . 4 | |||
| 4.2. Informative References . . . . . . . . . . . . . . . . . 7 | 2.4. The res-fresh parameter . . . . . . . . . . . . . . . . . 5 | |||
| 4.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 7 | 2.5. The cache-fresh parameter . . . . . . . . . . . . . . . . 5 | |||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 7 | 2.6. The collapse-hit parameter . . . . . . . . . . . . . . . 5 | |||
| 2.7. The collapse-wait parameter . . . . . . . . . . . . . . . 5 | ||||
| 2.8. The key parameter . . . . . . . . . . . . . . . . . . . . 5 | ||||
| 3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 5 | ||||
| 4. Security Considerations . . . . . . . . . . . . . . . . . . . 6 | ||||
| 5. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 | ||||
| 5.1. Normative References . . . . . . . . . . . . . . . . . . 7 | ||||
| 5.2. Informative References . . . . . . . . . . . . . . . . . 7 | ||||
| 5.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 8 | ||||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 8 | ||||
| 1. Introduction | 1. Introduction | |||
| To aid debugging, HTTP caches often append headers to a response | To aid debugging, HTTP caches often append headers to a response | |||
| detailing how they handled the request. | detailing how they handled the request. | |||
| Unfortunately, the semantics of these headers are often unclear, and | Unfortunately, the semantics of these headers are often unclear, and | |||
| both the semantics and syntax used vary greatly between | both the semantics and syntax used vary greatly between | |||
| implementations. | implementations. | |||
| This specification defines a single, new HTTP response header field, | This specification defines a single, new HTTP response header field, | |||
| "Cache" for this purpose. | "Cache-Status" for this purpose. | |||
| For example: | ||||
| Cache: HIT_FRESH; node="reverse-proxy.example.com:80"; | ||||
| key="https://example.com/foo|Accept-Encoding:gzip", | ||||
| HIT_STALE; node="FooCDN parent"; fresh=-45; age=200; latency=3, | ||||
| MISS; node="FooCDN edge"; fresh=-45; age=200; latency=98 | ||||
| 1.1. Notational Conventions | 1.1. Notational Conventions | |||
| The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | |||
| "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and | "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and | |||
| "OPTIONAL" in this document are to be interpreted as described in BCP | "OPTIONAL" in this document are to be interpreted as described in BCP | |||
| 14 [RFC2119] [RFC8174] when, and only when, they appear in all | 14 [RFC2119] [RFC8174] when, and only when, they appear in all | |||
| capitals, as shown here. | capitals, as shown here. | |||
| This document uses ABNF as defined in [RFC5234], along with the "%s" | This document uses ABNF as defined in [RFC5234], along with the "%s" | |||
| extension for case sensitivity defined in [RFC7405]. | extension for case sensitivity defined in [RFC7405]. | |||
| 2. The Cache HTTP Response Header | 2. The Cache-Status HTTP Response Header | |||
| The Cache HTTP response header indicates the handling of the request | The Cache-Status HTTP response header indicates caches' handling of | |||
| corresponding to the response it occurs within by caches along the | the request corresponding to the response it occurs within. | |||
| path. | ||||
| Its value is a Parameterised List | Its value is a List [I-D.ietf-httpbis-header-structure]: | |||
| [I-D.ietf-httpbis-header-structure]: | ||||
| Cache = sh-param-list | Cache-Status = sh-list | |||
| Each member of the parameterised list represents a cache that has | Each member of the parameterised list represents a cache that has | |||
| handled the request. | handled the request. The first member of the list represents the | |||
| cache closest to the origin server, and the last member of the list | ||||
| represents the cache closest to the user agent (possibly including | ||||
| the user agent's cache itself, if it chooses to append a value). | ||||
| The first member of the list represents the cache closest to the | Caches determine when it is appropriate to add the Cache-Status | |||
| origin server, and the last member of the list represents the cache | header field to a response. Some might decide to add it to all | |||
| closest to the user agent (possibly including the user agent's cache | responses, whereas others might only do so when specifically | |||
| itself, if it chooses to append a value). | configured to, or when the request contains a header that activates a | |||
| debugging mode. | ||||
| Caches determine when it is appropriate to add the Cache header field | When adding a value to the Cache-Status header field, caches SHOULD | |||
| to a response. Some might decide to add it to all responses, whereas | preserve the existing contents of the header, to allow debugging of | |||
| others might only do so when specifically configured to, or when the | the entire chain of caches handling the request. | |||
| request contains a header that activates a debugging mode. | ||||
| When adding a value to the Cache header field, caches SHOULD preserve | The list members identify the cache that inserted the value, and MUST | |||
| the existing contents of the header, to allow debugging of the entire | have a type of either sh-string or sh-token. Depending on the | |||
| chain of caches handling the request. | deployment, this might be a product or service name (e.g., | |||
| ExampleCache or "Example CDN"), a hostname ("cache-3.example.com"), | ||||
| and IP address, or a generated string. | ||||
| Identifiers in the parameterised list members are expected to be | Each member of the list can also have a number of parameters that | |||
| cache-actions: | describe that cache's handling of the request. While all of these | |||
| parameters are OPTIONAL, caches are encouraged to provide as much | ||||
| information as possible. | ||||
| cache-action = %s"HIT_FRESH" | fwd = sh-token | |||
| / %s"HIT_STALE" | fwd-res = sh-token | |||
| / %s"HIT_REFRESH_MODIFIED" | fwd-stored = sh-boolean | |||
| / %s"HIT_REFRESH_NOT_MODIFIED" | res-fresh = sh-integer | |||
| / %s"HIT_REFRESH_STALE" | cache-fresh = sh-integer | |||
| / %s"MISS" | collapse-hit = sh-boolean | |||
| / %s"MISS_CLIENT" | collapse-wait = sh-integer | |||
| / %s"BYPASS" | key = sh-string | |||
| / %s"ERROR" | ||||
| The semantics of cache-actions are: | 2.1. The fwd parameter | |||
| o HIT_FRESH - The cache used a fresh stored response to satisfy the | "fwd" indicates why the request went forward. If it is not present, | |||
| request without going forward | the value defaults to "none". | |||
| o HIT_STALE - The cache used a stale stored response to satisfy the | It can have one of the following values: * none - The request did not | |||
| request without going forward | go forward; i.e., it was a hit, and was served from the cache. * | |||
| bypass - The cache was configured to not handle this request * uri- | ||||
| miss - The cache did not contain any responses that matched the | ||||
| request URI * vary-miss - The cache contained a response that matched | ||||
| the request URI, but could not select a response based upon this | ||||
| request's headers. * miss - The cache did not contain any responses | ||||
| that could be used to satisfy this request (to be used when an | ||||
| implementation cannot distinguish between uri-miss and vary-miss) * | ||||
| res-stale - The cache was able to select a response for the request, | ||||
| but it was stale * req-stale - The cache was able to select a fresh | ||||
| response for the request, but client request headers (e.g., Cache- | ||||
| Control request directives) did not allow its use | ||||
| o HIT_REFRESH_MODIFIED - The cache had a stale stored response, went | 2.2. The fwd-res parameter | |||
| forward to validate it, and used the new response to satisfy the | ||||
| request | ||||
| o HIT_REFRESH_NOT_MODIFIED - The cache had a stale stored response, | "fwd-res" indicates what the result of the forward request was. It | |||
| went forward to validate it, and used the stored response to | is only valid when fwd is "res-stale" or "req-stale", and defaults to | |||
| satisfy the request | "full" if not present when fwd is one of those values. | |||
| o HIT_REFRESH_STALE - The cache had a stale stored response, went | It can have one of the following values: * full - indicates that the | |||
| forward to validate it, and encountered a problem, so the stored | response was a complete response (any status code except 304 Not | |||
| response was used to satisfy the request | Modified and 206 Partial Response) * partial - indicates that the | |||
| response was a 206 Partial Response * notmod - indicates that the | ||||
| response was a 304 Not Modified | ||||
| o MISS - The cache did not have a stored response, so the request | 2.3. The fwd-stored parameter | |||
| was forwarded | ||||
| o MISS_CLIENT - The client included request directives (e.g., | "fwd-stored" indicates whether the cache stored the response; a true | |||
| Pragma, Cache-Control) that prevented the cache from returning a | value indicates that it did. Only valid when fwd is not "none". | |||
| response, so the request was forwarded | ||||
| o BYPASS - The cache was configured to forward the request without | 2.4. The res-fresh parameter | |||
| attempting to use a stored response | ||||
| o ERROR - The cache was unable to use a stored response or obtain | "res-fresh" indicates the response's remaining freshness lifetime (as | |||
| one by going forward | per [I-D.ietf-httpbis-cache], Section 4.2.1), as an integer number of | |||
| seconds. This does not include freshness assigned by the cache (see | ||||
| "cache-fresh"). May be negative, to indicate staleness. | ||||
| Caches SHOULD use the most specific cache-action to a given response, | 2.5. The cache-fresh parameter | |||
| but are not required to use all cache-actions. Future updates to | ||||
| this specification can add additional cache-actions. | ||||
| Each member of the Cache header can also have any (or all, or none) | "cache-fresh" indicates the response's remaining freshness lifetime | |||
| of the following parameters: | as calculated by the cache, as an integer number of seconds. This | |||
| includes freshness assigned by the cache; e.g., through heuristics, | ||||
| local configuration, or other factors. May be negative, to indicate | ||||
| staleness. | ||||
| node = sh-string | If both cache-fresh and res-fresh appear as parameters on the same | |||
| fresh = sh-integer | value, it implies that the cache freshness overrode the response | |||
| age = sh-integer | freshness. | |||
| cacheable = sh-boolean | ||||
| key = sh-string | ||||
| latency = sh-integer | ||||
| cl_nm = sh-boolean | ||||
| Their semantics are: | 2.6. The collapse-hit parameter | |||
| o "node" - a string identifying for the cache node. MAY be a | "collapse-hit" indicates whether this request was collapsed together | |||
| hostname, IP address, or alias. | with one or more other forward requests; if true, the response was | |||
| successfully reused; if not, a new request had to be made. If not | ||||
| present, the request was not collapsed with others. | ||||
| o "fresh" - an integer indicating the cache's estimation of the | 2.7. The collapse-wait parameter | |||
| freshness lifetime ([RFC7234], Section 4.2.1) of this response in | ||||
| seconds, including any locally applied configuration. MAY be | ||||
| negative. | ||||
| o "age" - an integer indicating the cache's estimation of the age | "collapse-wait" indicates the amount of time that the cache held the | |||
| ([RFC7234], Section 4.2.3) of this response in seconds. MUST be 0 | request while waiting to see if it could be successfully collapsed, | |||
| or greater. | as an integer number of milliseconds. | |||
| o "cacheable" - a boolean indicating whether the cache can store | 2.8. The key parameter | |||
| this response, according to [RFC7234], Section 3 and any locally | ||||
| applied configuration. | ||||
| o "key" - a string representing the key that the cache has | "key" conveys a representation of the cache key used for the | |||
| associated with this response. This might include the request | response. Note that this may be implementation-specific. | |||
| URL, request headers, and other values. | ||||
| o "latency" - an integer indicating the amount of time in | 3. Examples | |||
| milliseconds between the receipt of a complete set of request | ||||
| headers and sending the complete set of response headers of this | ||||
| response, from the viewpoint of the cache. Note that this may not | ||||
| include buffering time in transport protocols and similar delays. | ||||
| o "cl_nm" - a boolean indicating whether the response to the client | The most minimal cache hit: | |||
| had a 304 Not Modified status code. | ||||
| While all of these parameters are OPTIONAL, caches are encouraged to | Cache-Status: ExampleCache | |||
| use the 'node' parameter to identify themselves. | ||||
| 3. Security Considerations | ... but a polite cache will give some more information, e.g.: | |||
| Cache-Status: ExampleCache; res-fresh=376 | ||||
| A "negative" hit (i.e., the cache imposed its own freshness | ||||
| lifetime): | ||||
| Cache-Status: ExampleCache; cache-fresh=415 | ||||
| A stale hit just has negative freshness: | ||||
| Cache-Status: ExampleCache; res-fresh=-412 | ||||
| Whereas a complete miss is: | ||||
| Cache-Status: ExampleCache; fwd=uri-miss | ||||
| A miss that validated on the back-end server: | ||||
| Cache-Status: ExampleCache; fwd=res-stale; fwd-res=notmod | ||||
| A miss that was collapsed with another request: | ||||
| Cache-Status: ExampleCache; fwd=uri-miss; collapse-hit=?1 | ||||
| A miss that the cache attempted to collapse, but couldn't: | ||||
| Cache-Status: ExampleCache; fwd=uri-miss; | ||||
| collapse-hit=?0; collapse-wait=240 | ||||
| Going through two layers of caching, both of which were hits, and the | ||||
| second collapsed with other requests: | ||||
| Cache-Status: "CDN Company Here"; res-fresh=545, | ||||
| OriginCache; cache-fresh=1100; collapse-hit=?1 | ||||
| 4. Security Considerations | ||||
| Information about a cache's content can be used to infer the activity | Information about a cache's content can be used to infer the activity | |||
| of those using it. Generally, access to sensitive information in a | of those using it. Generally, access to sensitive information in a | |||
| cache is limited to those who are authorised to access that | cache is limited to those who are authorised to access that | |||
| information (using a variety of techniques), so this does not | information (using a variety of techniques), so this does not | |||
| represent an attack vector in the general sense. | represent an attack vector in the general sense. | |||
| However, if the Cache header is exposed to parties who are not | However, if the Cache-Status header is exposed to parties who are not | |||
| authorised to obtain the response it occurs within, it could expose | authorised to obtain the response it occurs within, it could expose | |||
| information about that data. | information about that data. | |||
| For example, if an attacker were able to obtain the Cache header from | For example, if an attacker were able to obtain the Cache-Status | |||
| a response containing sensitive information and access were limited | header from a response containing sensitive information and access | |||
| to one person (or limited set of people), they could determine | were limited to one person (or limited set of people), they could | |||
| whether that information had been accessed before. This is similar | determine whether that information had been accessed before. This is | |||
| to the information exposed by various timing attacks, but is arguably | similar to the information exposed by various timing attacks, but is | |||
| more reliable, since the cache is directly reporting its state. | arguably more reliable, since the cache is directly reporting its | |||
| state. | ||||
| Mitigations include use of encryption (e.g., TLS [RFC8446])) to | Mitigations include use of encryption (e.g., TLS [RFC8446])) to | |||
| protect the response, and careful controls over access to response | protect the response, and careful controls over access to response | |||
| headers (as are present in the Web platform). When in doubt, the | headers (as are present in the Web platform). When in doubt, the | |||
| Cache header field can be omitted. | Cache-Status header field can be omitted. | |||
| 4. References | 5. References | |||
| 4.1. Normative References | 5.1. Normative References | |||
| [I-D.ietf-httpbis-cache] | ||||
| Fielding, R., Nottingham, M., and J. Reschke, "HTTP | ||||
| Caching", draft-ietf-httpbis-cache-05 (work in progress), | ||||
| July 2019. | ||||
| [I-D.ietf-httpbis-header-structure] | [I-D.ietf-httpbis-header-structure] | |||
| Nottingham, M. and P. Kamp, "Structured Headers for HTTP", | Nottingham, M. and P. Kamp, "Structured Headers for HTTP", | |||
| draft-ietf-httpbis-header-structure-09 (work in progress), | draft-ietf-httpbis-header-structure-13 (work in progress), | |||
| December 2018. | August 2019. | |||
| [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate | |||
| Requirement Levels", BCP 14, RFC 2119, | Requirement Levels", BCP 14, RFC 2119, | |||
| DOI 10.17487/RFC2119, March 1997, | DOI 10.17487/RFC2119, March 1997, | |||
| <https://www.rfc-editor.org/info/rfc2119>. | <https://www.rfc-editor.org/info/rfc2119>. | |||
| [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax | |||
| Specifications: ABNF", STD 68, RFC 5234, | Specifications: ABNF", STD 68, RFC 5234, | |||
| DOI 10.17487/RFC5234, January 2008, | DOI 10.17487/RFC5234, January 2008, | |||
| <https://www.rfc-editor.org/info/rfc5234>. | <https://www.rfc-editor.org/info/rfc5234>. | |||
| [RFC7234] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, | ||||
| Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching", | ||||
| RFC 7234, DOI 10.17487/RFC7234, June 2014, | ||||
| <https://www.rfc-editor.org/info/rfc7234>. | ||||
| [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", | [RFC7405] Kyzivat, P., "Case-Sensitive String Support in ABNF", | |||
| RFC 7405, DOI 10.17487/RFC7405, December 2014, | RFC 7405, DOI 10.17487/RFC7405, December 2014, | |||
| <https://www.rfc-editor.org/info/rfc7405>. | <https://www.rfc-editor.org/info/rfc7405>. | |||
| [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC | [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC | |||
| 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, | 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, | |||
| May 2017, <https://www.rfc-editor.org/info/rfc8174>. | May 2017, <https://www.rfc-editor.org/info/rfc8174>. | |||
| 4.2. Informative References | 5.2. Informative References | |||
| [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol | [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol | |||
| Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, | Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, | |||
| <https://www.rfc-editor.org/info/rfc8446>. | <https://www.rfc-editor.org/info/rfc8446>. | |||
| 4.3. URIs | 5.3. URIs | |||
| [1] https://lists.w3.org/Archives/Public/ietf-http-wg/ | [1] https://lists.w3.org/Archives/Public/ietf-http-wg/ | |||
| [2] https://httpwg.org/ | [2] https://httpwg.org/ | |||
| [3] https://github.com/httpwg/http-extensions/labels/cache-header | [3] https://github.com/httpwg/http-extensions/labels/cache-header | |||
| Author's Address | Author's Address | |||
| Mark Nottingham | Mark Nottingham | |||
| End of changes. 48 change blocks. | ||||
| 131 lines changed or deleted | 170 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||