8246
PROPOSED STANDARD
HTTP Immutable Responses
Authors: P. McManus
Date: September 2017
Area: wit
Working Group: httpbis
Stream: IETF
Abstract
The immutable HTTP response Cache-Control extension allows servers to identify resources that will not be updated during their freshness lifetime. This ensures that a client never needs to revalidate a cached fresh resource to be certain it has not been modified.
RFC 8246
PROPOSED STANDARD
Internet Engineering Task Force (IETF) P. McManus
Request for Comments: 8246 Mozilla
Category: Standards Track September 2017
ISSN: 2070-1721
<span class="h1">HTTP Immutable Responses</span>
Abstract
The immutable HTTP response Cache-Control extension allows servers to
identify resources that will not be updated during their freshness
lifetime. This ensures that a client never needs to revalidate a
cached fresh resource to be certain it has not been modified.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc7841#section-2">Section 2 of RFC 7841</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="https://www.rfc-editor.org/info/rfc8246">https://www.rfc-editor.org/info/rfc8246</a>.
Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
<span class="grey">McManus Standards Track [Page 1]</span>
<span id="page-2" ></span>
<span class="grey"><a href="./rfc8246">RFC 8246</a> HTTP Immutable Response September 2017</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-1.1">1.1</a>. Notational Conventions . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-2">2</a>. The Immutable Cache-Control Extension . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-2.1">2.1</a>. About Intermediaries . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-2.2">2.2</a>. Example . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-3">3</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-4">4</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-5">5</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-5.1">5.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-5.2">5.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
HTTP's freshness lifetime mechanism [<a href="./rfc7234" title=""Hypertext Transfer Protocol (HTTP/1.1): Caching"">RFC7234</a>] allows a client to
safely reuse a stored response to satisfy future requests for a
specified period of time. However, it is still possible that the
resource will be modified during that period.
For instance, a front-page newspaper photo with a freshness lifetime
of one hour would mean that no user would see a cached photo more
than one hour old. However, the photo could be updated at any time,
resulting in different users seeing different photos depending on the
contents of their caches for up to one hour. This is compliant with
the caching mechanism defined in [<a href="./rfc7234" title=""Hypertext Transfer Protocol (HTTP/1.1): Caching"">RFC7234</a>].
Users that need to confirm there have been no updates to their cached
responses typically use the reload (or refresh) mechanism in their
user agents. This in turn generates a conditional request [<a href="./rfc7232" title=""Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests"">RFC7232</a>],
and either a new representation or, if unmodified, a 304 (Not
Modified) response [<a href="./rfc7232" title=""Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests"">RFC7232</a>] is returned. A user agent that
understands HTML and fetches its dependent sub-resources might issue
hundreds of conditional requests to refresh all portions of a common
page [<a href="#ref-REQPERPAGE">REQPERPAGE</a>].
However, some content providers never create more than one variant of
a sub-resource, because they use "versioned" URLs. When these
resources need an update, they are simply published under a new URL,
typically embedding an identifier unique to that version of the
resource in the path, and references to the sub-resource are updated
with the new path information.
For example, "https://www.example.com/101016/main.css" might be
updated and republished as "https://www.example.com/102026/main.css",
with any links that reference it being changed at the same time.
<span class="grey">McManus Standards Track [Page 2]</span>
<span id="page-3" ></span>
<span class="grey"><a href="./rfc8246">RFC 8246</a> HTTP Immutable Response September 2017</span>
This design pattern allows a very large freshness lifetime to be used
for the sub-resource without guessing when it will be updated in the
future.
Unfortunately, the user agent does not know when this versioned URL
design pattern is used. As a result, user-driven refreshes still
translate into wasted conditional requests for each sub-resource as
each will return 304 responses.
The immutable HTTP response Cache-Control extension allows servers to
identify responses that will not be updated during their freshness
lifetimes.
This effectively informs clients that any conditional request for
that response can be safely skipped without worrying that it has been
updated.
<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>. Notational Conventions</span>
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 <a href="https://www.rfc-editor.org/bcp/bcp14">BCP</a>
<a href="https://www.rfc-editor.org/bcp/bcp14">14</a> [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>] [<a href="./rfc8174" title=""Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"">RFC8174</a>] when, and only when, they appear in all
capitals, as shown here.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. The Immutable Cache-Control Extension</span>
When present in an HTTP response, the immutable Cache-Control
extension indicates that the origin server will not update the
representation of that resource during the freshness lifetime of the
response.
Clients SHOULD NOT issue a conditional request during the response's
freshness lifetime (e.g., upon a reload) unless explicitly overridden
by the user (e.g., a force reload).
The immutable extension only applies during the freshness lifetime of
the stored response. Stale responses SHOULD be revalidated as they
normally would be in the absence of the immutable extension.
The immutable extension takes no arguments. If any arguments are
present, they have no meaning and MUST be ignored. Multiple
instances of the immutable extension are equivalent to one instance.
The presence of an immutable Cache-Control extension in a request has
no effect.
<span class="grey">McManus Standards Track [Page 3]</span>
<span id="page-4" ></span>
<span class="grey"><a href="./rfc8246">RFC 8246</a> HTTP Immutable Response September 2017</span>
<span class="h3"><a class="selflink" id="section-2.1" href="#section-2.1">2.1</a>. About Intermediaries</span>
An immutable response has the same semantic meaning when received by
proxy clients as it does when received by user-agent-based clients.
Therefore, proxies SHOULD skip conditionally revalidating fresh
responses containing the immutable extension unless there is a signal
from the client that a validation is necessary (e.g., a no-cache
Cache-Control request directive defined in <a href="./rfc7234#section-5.2.1.4">Section 5.2.1.4 of
[RFC7234]</a>).
A proxy that uses the immutable extension to bypass a conditional
revalidation can choose whether to reply with a 304 or 200 response
to its requesting client based on the request headers the proxy
received.
<span class="h3"><a class="selflink" id="section-2.2" href="#section-2.2">2.2</a>. Example</span>
Cache-Control: max-age=31536000, immutable
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Security Considerations</span>
The immutable mechanism acts as form of soft pinning and, as with all
pinning mechanisms, creates a vector for amplification of cache
corruption incidents. These incidents include cache-poisoning
attacks. Three mechanisms are suggested for mitigation of this risk:
o Clients SHOULD ignore the immutable extension from resources that
are not part of an authenticated context such as HTTPS.
Authenticated resources are less vulnerable to cache poisoning.
o User agents often provide two different refresh mechanisms: reload
and some form of force-reload. The latter is used to rectify
interrupted loads and other corruption. These reloads, typically
indicated through no-cache request attributes, SHOULD ignore the
immutable extension as well.
o Clients SHOULD ignore the immutable extension for resources that
do not provide a strong indication that the stored response size
is the correct response size such as responses delimited by
connection close.
<span class="grey">McManus Standards Track [Page 4]</span>
<span id="page-5" ></span>
<span class="grey"><a href="./rfc8246">RFC 8246</a> HTTP Immutable Response September 2017</span>
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. IANA Considerations</span>
The immutable extension has been registered in the "Hypertext
Transfer Protocol (HTTP) Cache Directive Registry" per the guidelines
described in <a href="./rfc7234#section-7.1">Section 7.1 of [RFC7234]</a>.
o Cache Directive: immutable
o Reference: <a href="./rfc8246">RFC 8246</a>
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. References</span>
<span class="h3"><a class="selflink" id="section-5.1" href="#section-5.1">5.1</a>. Normative References</span>
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
DOI 10.17487/RFC2119, March 1997,
<<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>>.
[<a id="ref-RFC7232">RFC7232</a>] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
Protocol (HTTP/1.1): Conditional Requests", <a href="./rfc7232">RFC 7232</a>,
DOI 10.17487/RFC7232, June 2014,
<<a href="https://www.rfc-editor.org/info/rfc7232">https://www.rfc-editor.org/info/rfc7232</a>>.
[<a id="ref-RFC7234">RFC7234</a>] Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke,
Ed., "Hypertext Transfer Protocol (HTTP/1.1): Caching",
<a href="./rfc7234">RFC 7234</a>, DOI 10.17487/RFC7234, June 2014,
<<a href="https://www.rfc-editor.org/info/rfc7234">https://www.rfc-editor.org/info/rfc7234</a>>.
[<a id="ref-RFC8174">RFC8174</a>] Leiba, B., "Ambiguity of Uppercase vs Lowercase in <a href="./rfc2119">RFC</a>
<a href="./rfc2119">2119</a> Key Words", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc8174">RFC 8174</a>, DOI 10.17487/RFC8174,
May 2017, <<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>>.
<span class="h3"><a class="selflink" id="section-5.2" href="#section-5.2">5.2</a>. Informative References</span>
[<a id="ref-REQPERPAGE">REQPERPAGE</a>]
HTTP Archive, "Total Requests per Page",
<<a href="http://httparchive.org/interesting.php#reqTotal">http://httparchive.org/interesting.php#reqTotal</a>>.
<span class="grey">McManus Standards Track [Page 5]</span>
<span id="page-6" ></span>
<span class="grey"><a href="./rfc8246">RFC 8246</a> HTTP Immutable Response September 2017</span>
Acknowledgments
Thank you to Ben Maurer for partnership in developing and testing
this idea. Thank you to Amos Jeffries for help with proxy
interactions and to Mark Nottingham for help with the documentation.
Author's Address
Patrick McManus
Mozilla
Email: [email protected]
McManus Standards Track [Page 6]
Annotations
Select text to annotate