HTTP Cache-Control Extensions for Stale Content
RFC 5861
Independent Submission M. Nottingham
Request for Comments: 5861 Yahoo! Inc.
Category: Informational May 2010
ISSN: 2070-1721
HTTP Cache-Control Extensions for Stale Content
Abstract
This document defines two independent HTTP Cache-Control extensions
that allow control over the use of stale responses by caches.
Status of This Memo
This document is not an Internet Standards Track specification; it is
published for informational purposes.
This is a contribution to the RFC Series, independently of any other
RFC stream. The RFC Editor has chosen to publish this document at
its discretion and makes no statement about its value for
implementation or deployment. Documents approved for publication by
the RFC Editor are not a candidate for any level of Internet
Standard; see Section 2 of RFC 5741.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
http://www.rfc-editor.org/info/rfc5861.
Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) 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.
Nottingham Informational [Page 1]
RFC 5861 HTTP stale controls May 2010
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
2. Notational Conventions . . . . . . . . . . . . . . . . . . . . 2
3. The stale-while-revalidate Cache-Control Extension . . . . . . 2
3.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4. The stale-if-error Cache-Control Extension . . . . . . . . . . 3
4.1. Example . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5. Security Considerations . . . . . . . . . . . . . . . . . . . . 5
6. Normative References . . . . . . . . . . . . . . . . . . . . . 5
Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . . 6
1. Introduction
HTTP [RFC2616] requires that caches "respond to a request with the
most up-to-date response held... that is appropriate to the request,"
although "in carefully considered circumstances" a stale response is
allowed to be returned. This document defines two independent Cache-
Control extensions that allow for such control, stale-if-error and
stale-while-revalidate.
The stale-if-error HTTP Cache-Control extension allows a cache to
return a stale response when an error -- e.g., a 500 Internal Server
Error, a network segment, or DNS failure -- is encountered, rather
than returning a "hard" error. This improves availability.
The stale-while-revalidate HTTP Cache-Control extension allows a
cache to immediately return a stale response while it revalidates it
in the background, thereby hiding latency (both in the network and on
the server) from clients.
2. Notational Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119].
This specification uses the augmented Backus-Naur Form of RFC 2616
[RFC2616], and it includes the delta-seconds rule from that
specification.
3. The stale-while-revalidate Cache-Control Extension
When present in an HTTP response, the stale-while-revalidate Cache-
Control extension indicates that caches MAY serve the response in
which it appears after it becomes stale, up to the indicated number
of seconds.
Nottingham Informational [Page 2]
RFC 5861 HTTP stale controls May 2010
stale-while-revalidate = "stale-while-revalidate" "=" delta-seconds
If a cached response is served stale due to the presence of this
extension, the cache SHOULD attempt to revalidate it while still
serving stale responses (i.e., without blocking).
Note that "stale" implies that the response will have a non-zero Age
header and a warning header, as per HTTP's requirements.
If delta-seconds passes without the cached entity being revalidated,
it SHOULD NOT continue to be served stale, absent other information.
3.1. Example
A response containing:
Cache-Control: max-age=600, stale-while-revalidate=30
indicates that it is fresh for 600 seconds, and it may continue to be
served stale for up to an additional 30 seconds while an asynchronous
validation is attempted. If validation is inconclusive, or if there
Show full document text