The Cache-Status HTTP Response Header FieldFastlymnot@mnot.nethttps://www.mnot.net/
Applications and Real-Time
HTTPInternet-DraftTo aid debugging, HTTP caches often append headers to a response detailing how they handled the request. This specification codifies that practice and updates it for HTTP’s current caching model.RFC EDITOR: please remove this section before publicationDiscussion of this draft takes place on the HTTP working group mailing list
(ietf-http-wg@w3.org), which is archived at https://lists.w3.org/Archives/Public/ietf-http-wg/.Working Group information can be found at https://httpwg.org/; source
code and issues list for this draft can be found at
https://github.com/httpwg/http-extensions/labels/cache-header.To aid debugging, HTTP caches often append headers to a response detailing how they handled the request.Unfortunately, the semantics of these headers are often unclear, and both the semantics and syntax used vary greatly between implementations.This specification defines a single, new HTTP response header field, “Cache-Status” for this purpose.The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as
described in BCP 14 when, and only when, they appear in all capitals, as
shown here.This document uses ABNF as defined in , along with the “%s” extension for case sensitivity defined in .The Cache-Status HTTP response header indicates caches’ handling of the request corresponding to the response it occurs within.Its value is a List :Each member of the list represents a cache that has 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 client (possibly including the user agent’s cache itself, if it chooses to append a value).Caches determine when it is appropriate to add the Cache-Status header field to a response. Some might decide to add it to all responses, whereas others might only do so when specifically configured to, or when the request contains a header that activates a debugging mode.When adding a value to the Cache-Status header field, caches SHOULD preserve the existing contents of the header, to allow debugging of the entire chain of caches handling the request.Each list member identifies the cache that inserted that value, and MUST have a type of either sh-string or sh-token. Depending on the 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.Each member of the list can also have parameters that 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.This specification defines these parameters:“hit”, when true, indicates that the request was satisfied by the cache; i.e., it did not go forward, and the response was obtained from the cache (possibly with modifications; e.g., if the request was conditional, a 304 Not Modified could be generated from cache).“hit” and “fwd” are exclusive; only one of them should appear on each list member.“fwd” indicates why the request went forward.It can have one of the following values:uri-miss - The cache did not contain any responses that matched the request URIvary-miss - The cache contained a response that matched the request URI, but could not select a response based upon this request’s headers and stored Vary 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)stale - The cache was able to select a response for the request, but it was stalerequest - 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 usebypass - The cache was configured to not handle this request“fwd-status” indicates what status code the next hop server returned in response to the request. Only meaningful when “fwd” is present; if “fwd-status” is not present but “fwd” is, it defaults to the status code sent in the response.This parameter is useful to distinguish cases when the next hop server sends a 304 Not Modified response to a conditional request, or a 206 Partial Response due to a range request.“ttl” indicates the response’s remaining freshness lifetime as calculated by the cache, as an integer number of seconds, measured when the response is sent by the cache. This includes freshness assigned by the cache; e.g., through heuristics, local configuration, or other factors. May be negative, to indicate staleness.“stored” indicates whether the cache stored the forward response; a true value indicates that it did. Only meaningful when fwd is present.“collapsed” indicates whether this request was collapsed together 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. Only meaningful when fwd is present.“key” conveys a representation of the cache key used for the response. Note that this may be implementation-specific.The most minimal cache hit:… but a polite cache will give some more information, e.g.:A stale hit just has negative freshness:Whereas a complete miss is:A miss that successfully validated on the back-end server:A miss that was collapsed with another request:A miss that the cache attempted to collapse, but couldn’t:Going through two layers of caching, both of which were hits, and the second collapsed with other requests:Information about a cache’s content can be used to infer the activity of those using it. Generally, access to sensitive information in a cache is limited to those who are authorised to access that information (using a variety of techniques), so this does not represent an attack vector in the general sense.However, if the Cache-Status header is exposed to parties who are not authorised to obtain the response it occurs within, it could expose information about that data.For example, if an attacker were able to obtain the Cache-Status header from a response containing sensitive information and access were limited to one person (or limited set of people), they could determine whether that information had been accessed before. This is similar to the information exposed by various timing attacks, but is arguably more reliable, since the cache is directly reporting its state.Mitigations include use of encryption (e.g., TLS )) to protect the response, and careful controls over access to response headers (as are present in the Web platform). When in doubt, the Cache-Status header field can be omitted.Key words for use in RFCs to Indicate Requirement LevelsIn many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.Ambiguity of Uppercase vs Lowercase in RFC 2119 Key WordsRFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.Augmented BNF for Syntax Specifications: ABNFInternet technical specifications often need to define a formal syntax. Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications. The current specification documents ABNF. It balances compactness and simplicity with reasonable representational power. The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value ranges. This specification also supplies additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications. [STANDARDS-TRACK]Case-Sensitive String Support in ABNFThis document extends the base definition of ABNF (Augmented Backus-Naur Form) to include a way to specify US-ASCII string literals that are matched in a case-sensitive manner.Structured Headers for HTTPThis document describes a set of data types and associated algorithms that are intended to make it easier and safer to define and handle HTTP header fields. It is intended for use by specifications of new HTTP header fields that wish to use a common syntax that is more restrictive than traditional HTTP field values.The Transport Layer Security (TLS) Protocol Version 1.3This document specifies version 1.3 of the Transport Layer Security (TLS) protocol. TLS allows client/server applications to communicate over the Internet in a way that is designed to prevent eavesdropping, tampering, and message forgery.This document updates RFCs 5705 and 6066, and obsoletes RFCs 5077, 5246, and 6961. This document also specifies new requirements for TLS 1.2 implementations.