Independent Submission M. Nottingham
Request for Comments: 5861 Yahoo! Inc.
Category: Informational May 2010
ISSN: 2070-1721
HTTP Cache-Control Extensions for Stale Content
Nottingham Informational [Page 1]
RFC 5861 HTTP stale controls May 2010
Table of Contents
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.
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].
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
3.1. Example
A response containing:
4. The stale-if-error Cache-Control Extension
The stale-if-error Cache-Control extension indicates that when an error is encountered, a cached stale response MAY be used to satisfy the request, regardless of other freshness information.
Nottingham Informational [Page 3]
RFC 5861 HTTP stale controls May 2010
When used as a request Cache-Control extension, its scope of application is the request it appears in; when used as a response Cache-Control extension, its scope is any request applicable to the cached response in which it occurs.
4.1. Example
A response containing:
Nottingham Informational [Page 4]
RFC 5861 HTTP stale controls May 2010
HTTP/1.1 500 Internal Server Error Content-Type: text/plain
5. Security Considerations
The stale-while-revalidate extension provides origin servers with a mechanism for dictating that stale content should be served from caches under certain circumstances, with the expectation that the cached response will be revalidated in the background. It is suggested that such validation be predicated upon an incoming request, to avoid the possibility of an amplification attack (as can be seen in some other pre-fetching and automatic refresh mechanisms). Cache implementers should keep this in mind when deciding the circumstances under which they will generate a request that is not directly initiated by a user or client.
6. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Nottingham Informational [Page 5]
RFC 5861 HTTP stale controls May 2010 Appendix A. AcknowledgementsThanks to Ben Drees, John Nienart, Henrik Nordstrom, Evan Torrie, and Chris Westin for their suggestions. The author takes all responsibility for errors and omissions.