draft-ietf-httpbis-cache-header-02.txt   draft-ietf-httpbis-cache-header-03.txt 
HTTP M. Nottingham HTTP M. Nottingham
Internet-Draft Fastly Internet-Draft Fastly
Intended status: Standards Track November 4, 2019 Intended status: Standards Track March 1, 2020
Expires: May 7, 2020 Expires: September 2, 2020
The Cache-Status HTTP Response Header The Cache-Status HTTP Response Header Field
draft-ietf-httpbis-cache-header-02 draft-ietf-httpbis-cache-header-03
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 May 7, 2020. This Internet-Draft will expire on September 2, 2020.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2020 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-Status HTTP Response Header . . . . . . . . . . . . 3 2. The Cache-Status HTTP Response Header Field . . . . . . . . . 3
2.1. The fwd parameter . . . . . . . . . . . . . . . . . . . . 4 2.1. The hit parameter . . . . . . . . . . . . . . . . . . . . 4
2.2. The fwd-res parameter . . . . . . . . . . . . . . . . . . 4 2.2. The fwd parameter . . . . . . . . . . . . . . . . . . . . 4
2.3. The fwd-stored parameter . . . . . . . . . . . . . . . . 5 2.3. The fwd-status parameter . . . . . . . . . . . . . . . . 5
2.4. The res-fresh parameter . . . . . . . . . . . . . . . . . 5 2.4. The ttl parameter . . . . . . . . . . . . . . . . . . . . 5
2.5. The cache-fresh parameter . . . . . . . . . . . . . . . . 5 2.5. The stored parameter . . . . . . . . . . . . . . . . . . 5
2.6. The collapse-hit parameter . . . . . . . . . . . . . . . 5 2.6. The collapsed parameter . . . . . . . . . . . . . . . . . 5
2.7. The collapse-wait parameter . . . . . . . . . . . . . . . 5 2.7. The key parameter . . . . . . . . . . . . . . . . . . . . 5
2.8. The key parameter . . . . . . . . . . . . . . . . . . . . 6 3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4. Security Considerations . . . . . . . . . . . . . . . . . . . 6
4. Security Considerations . . . . . . . . . . . . . . . . . . . 7
5. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 5. References . . . . . . . . . . . . . . . . . . . . . . . . . 7
5.1. Normative References . . . . . . . . . . . . . . . . . . 7 5.1. Normative References . . . . . . . . . . . . . . . . . . 7
5.2. Informative References . . . . . . . . . . . . . . . . . 8 5.2. Informative References . . . . . . . . . . . . . . . . . 7
5.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 8 5.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 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.
skipping to change at page 3, line 16 skipping to change at page 3, line 16
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-Status HTTP Response Header 2. The Cache-Status HTTP Response Header Field
The Cache-Status HTTP response header indicates caches' handling of The Cache-Status HTTP response header indicates caches' handling of
the request corresponding to the response it occurs within. the request corresponding to the response it occurs within.
Its value is a List [I-D.ietf-httpbis-header-structure]: Its value is a List [I-D.ietf-httpbis-header-structure]:
Cache-Status = sh-list Cache-Status = sh-list
Each member of the parameterised list represents a cache that has Each member of the list represents a cache that has handled the
handled the request. The first member of the list represents the request. The first member of the list represents the cache closest
cache closest to the origin server, and the last member of the list to the origin server, and the last member of the list represents the
represents the cache closest to the user agent (possibly including cache closest to the client (possibly including the user agent's
the user agent's cache itself, if it chooses to append a value). cache itself, if it chooses to append a value).
Caches determine when it is appropriate to add the Cache-Status Caches determine when it is appropriate to add the Cache-Status
header field to a response. Some might decide to add it to all header field to a response. Some might decide to add it to all
responses, whereas others might only do so when specifically responses, whereas others might only do so when specifically
configured to, or when the request contains a header that activates a configured to, or when the request contains a header that activates a
debugging mode. debugging mode.
When adding a value to the Cache-Status header field, caches SHOULD When adding a value to the Cache-Status header field, caches SHOULD
preserve the existing contents of the header, to allow debugging of preserve the existing contents of the header, to allow debugging of
the entire chain of caches handling the request. the entire chain of caches handling the request.
The list members identify the cache that inserted the value, and MUST Each list member identifies the cache that inserted that value, and
have a type of either sh-string or sh-token. Depending on the 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., deployment, this might be a product or service name (e.g.,
ExampleCache or "Example CDN"), a hostname ("cache-3.example.com"), ExampleCache or "Example CDN"), a hostname ("cache-3.example.com"),
and IP address, or a generated string. and IP address, or a generated string.
Each member of the list can also have a number of parameters that Each member of the list can also have parameters that describe that
describe that cache's handling of the request. While all of these cache's handling of the request. While all of these parameters are
parameters are OPTIONAL, caches are encouraged to provide as much OPTIONAL, caches are encouraged to provide as much information as
information as possible. possible.
fwd = sh-token This specification defines these parameters:
fwd-res = sh-token
fwd-stored = sh-boolean
res-fresh = sh-integer
cache-fresh = sh-integer
collapse-hit = sh-boolean
collapse-wait = sh-integer
key = sh-string
2.1. The fwd parameter hit = sh-boolean
fwd = sh-token
fwd-status = sh-integer
ttl = sh-integer
stored = sh-boolean
collapsed = sh-boolean
key = sh-string
"fwd" indicates why the request went forward. If it is not present, 2.1. The hit parameter
the value defaults to "none".
It can have one of the following values: "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).
o none - The request did not go forward; i.e., it was a hit, and was "hit" and "fwd" are exclusive; only one of them should appear on each
served from the cache. list member.
o bypass - The cache was configured to not handle this request 2.2. The fwd parameter
"fwd" indicates why the request went forward.
It can have one of the following values:
o uri-miss - The cache did not contain any responses that matched o uri-miss - The cache did not contain any responses that matched
the request URI the request URI
o vary-miss - The cache contained a response that matched the o vary-miss - The cache contained a response that matched the
request URI, but could not select a response based upon this request URI, but could not select a response based upon this
request's headers. request's headers and stored Vary headers.
o miss - The cache did not contain any responses that could be used o miss - The cache did not contain any responses that could be used
to satisfy this request (to be used when an implementation cannot to satisfy this request (to be used when an implementation cannot
distinguish between uri-miss and vary-miss) distinguish between uri-miss and vary-miss)
o res-stale - The cache was able to select a response for the o stale - The cache was able to select a response for the request,
request, but it was stale but it was stale
o req-stale - The cache was able to select a fresh response for the o request - The cache was able to select a fresh response for the
request, but client request headers (e.g., Cache-Control request request, but client request headers (e.g., Cache-Control request
directives) did not allow its use directives) did not allow its use
2.2. The fwd-res parameter o bypass - The cache was configured to not handle this request
"fwd-res" indicates what the result of the forward request was. It
is only valid when fwd is "res-stale" or "req-stale", and defaults to
"full" if not present when fwd is one of those values.
It can have one of the following values:
o full - indicates that the response was a complete response (any
status code except 304 Not Modified and 206 Partial Response)
o partial - indicates that the response was a 206 Partial Response
o notmod - indicates that the response was a 304 Not Modified
2.3. The fwd-stored parameter 2.3. The fwd-status parameter
"fwd-stored" indicates whether the cache stored the response; a true "fwd-status" indicates what status code the next hop server returned
value indicates that it did. Only valid when fwd is not "none". 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.
2.4. The res-fresh parameter 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.
"res-fresh" indicates the response's remaining freshness lifetime (as 2.4. The ttl parameter
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.
2.5. The cache-fresh parameter "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.
"cache-fresh" indicates the response's remaining freshness lifetime 2.5. The stored parameter
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.
If both cache-fresh and res-fresh appear as parameters on the same "stored" indicates whether the cache stored the forward response; a
value, it implies that the cache freshness overrode the response true value indicates that it did. Only meaningful when fwd is
freshness. present.
2.6. The collapse-hit parameter 2.6. The collapsed parameter
"collapse-hit" indicates whether this request was collapsed together "collapsed" indicates whether this request was collapsed together
with one or more other forward requests; if true, the response was 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 successfully reused; if not, a new request had to be made. If not
present, the request was not collapsed with others. present, the request was not collapsed with others. Only meaningful
when fwd is present.
2.7. The collapse-wait parameter
"collapse-wait" indicates the amount of time that the cache held the
request while waiting to see if it could be successfully collapsed,
as an integer number of milliseconds.
2.8. The key parameter 2.7. The key parameter
"key" conveys a representation of the cache key used for the "key" conveys a representation of the cache key used for the
response. Note that this may be implementation-specific. response. Note that this may be implementation-specific.
3. Examples 3. Examples
The most minimal cache hit: The most minimal cache hit:
Cache-Status: ExampleCache Cache-Status: ExampleCache; hit
... but a polite cache will give some more information, e.g.: ... but a polite cache will give some more information, e.g.:
Cache-Status: ExampleCache; res-fresh=376 Cache-Status: ExampleCache; hit; ttl=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: A stale hit just has negative freshness:
Cache-Status: ExampleCache; res-fresh=-412 Cache-Status: ExampleCache; hit; ttl=-412
Whereas a complete miss is: Whereas a complete miss is:
Cache-Status: ExampleCache; fwd=uri-miss Cache-Status: ExampleCache; fwd=uri-miss
A miss that validated on the back-end server: A miss that successfully validated on the back-end server:
Cache-Status: ExampleCache; fwd=res-stale; fwd-res=notmod Cache-Status: ExampleCache; fwd=stale; fwd-status=304
A miss that was collapsed with another request: A miss that was collapsed with another request:
Cache-Status: ExampleCache; fwd=uri-miss; collapse-hit=?1 Cache-Status: ExampleCache; fwd=uri-miss; collapsed
A miss that the cache attempted to collapse, but couldn't: A miss that the cache attempted to collapse, but couldn't:
Cache-Status: ExampleCache; fwd=uri-miss; Cache-Status: ExampleCache; fwd=uri-miss; collapsed=?0
collapse-hit=?0; collapse-wait=240
Going through two layers of caching, both of which were hits, and the Going through two layers of caching, both of which were hits, and the
second collapsed with other requests: second collapsed with other requests:
Cache-Status: "CDN Company Here"; res-fresh=545, Cache-Status: OriginCache; hit; ttl=1100; collapsed,
OriginCache; cache-fresh=1100; collapse-hit=?1 "CDN Company Here"; hit; ttl=545
4. Security Considerations 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-Status header is exposed to parties who are not However, if the Cache-Status header is exposed to parties who are not
skipping to change at page 7, line 34 skipping to change at page 7, line 11
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-Status header field can be omitted. Cache-Status header field can be omitted.
5. References 5. References
5.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-13 (work in progress), draft-ietf-httpbis-header-structure-13 (work in progress),
August 2019. 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>.
 End of changes. 40 change blocks. 
112 lines changed or deleted 87 lines changed or added

This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/