NetworkHTTPbis Working Group R. Fielding, Ed. Internet-Draft Day Software Obsoletes: 2616 (if approved) J. Gettys Intended status: Standards Track One Laptop per Child Expires:May 20,September 10, 2009 J. Mogul HP H. Frystyk Microsoft L. Masinter Adobe Systems P. Leach Microsoft T. Berners-Lee W3C/MIT Y. Lafon, Ed. W3C J. Reschke, Ed. greenbytesNovember 16, 2008March 9, 2009 HTTP/1.1, part 6: Cachingdraft-ietf-httpbis-p6-cache-05draft-ietf-httpbis-p6-cache-06 Status of this MemoBy submitting this Internet-Draft, each author represents that any applicable patent or other IPR claimsThis Internet-Draft is submitted to IETF in full conformance with the provisions ofwhich heBCP 78 and BCP 79. This document may contain material from IETF Documents orshe is aware have beenIETF Contributions published orwillmade publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not bedisclosed,modified outside the IETF Standards Process, andanyderivative works ofwhich he or she becomes aware willit may not bedisclosed, in accordance with Section 6 of BCP 79.created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire onMay 20,September 10, 2009. Copyright Notice Copyright (c) 2009 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 in effect on the date of publication of this document (http://trustee.ietf.org/license-info). Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Abstract The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems.HTTP has been in use by the World Wide Web global information initiative since 1990.This document is Part 6 of the seven-part specification that defines the protocol referred to as "HTTP/1.1" and, taken together, obsoletes RFC 2616. Part 6 defines requirements on HTTP caches and the associated header fields that control cache behavior or indicate cacheable response messages. Editorial Note (To be removed by RFC Editor) Discussion of this draft should take place on the HTTPBIS working group mailing list (ietf-http-wg@w3.org). The current issues list is at <http://tools.ietf.org/wg/httpbis/trac/report/11> and related documents (including fancy diffs) can be found at <http://tools.ietf.org/wg/httpbis/>. The changes in this draft are summarized in AppendixB.6.C.7. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . .65 1.3. Requirements . . . . . . . . . . . . . . . . . . . . . . .7 2. Notational Conventions and Generic Grammar6 1.4. Syntax Notation . . . . . . . . . .8 3. Overview. . . . . . . . . . . 7 1.4.1. Core Rules . . . . . . . . . . . . . . . .8 3.1. Cache Correctness. . . . . . 7 1.4.2. ABNF Rules defined in other Parts of the Specification . . . . . . . . . . . . . .8 3.2. Warnings. . . . . . 7 2. Cache Operation . . . . . . . . . . . . . . . . . . .9 3.3. Cache-control Mechanisms. . . . 7 2.1. Response Cacheability . . . . . . . . . . . . .10 3.4. Explicit User Agent Warnings. . . . . 7 2.1.1. Storing Partial and Incomplete Responses . . . . . . . 8 2.2. Constructing Responses from Caches . . .10 3.5. Exceptions to the Rules and Warnings. . . . . . . . . 8 2.3. Freshness Model . .11 3.6. Client-controlled Behavior. . . . . . . . . . . . . . . .11 4. Expiration Model. . . 9 2.3.1. Calculating Freshness Lifetime . . . . . . . . . . . . 10 2.3.2. Calculating Age . . . . . . . .12 4.1. Server-Specified Expiration. . . . . . . . . . . 11 2.3.3. Serving Stale Responses . . . .12 4.2. Heuristic Expiration. . . . . . . . . . . 13 2.4. Validation Model . . . . . . . .13 4.3. Age Calculations. . . . . . . . . . . . . 13 2.5. Request Methods that Invalidate . . . . . . . .13 4.4. Expiration Calculations. . . . . 14 2.6. Caching Negotiated Responses . . . . . . . . . . . .15 4.5. Disambiguating Expiration Values. . .. . . . . . . . . . 16 4.6. Disambiguating Multiple15 2.7. Combining Responses . . . . . . . . . . . .17 5. Validation Model . . . . .. . . . . . . 16 3. Header Field Definitions . . . . . . . . . . .17 6. Response Cacheability. . . . . . . . 16 3.1. Age . . . . . . . . . . . .18 7. Constructing Responses From Caches. . . . . . . . . . . . . .19 7.1. End-to-end and Hop-by-hop Headers. 17 3.2. Cache-Control . . . . . . . . . . .19 7.2. Non-modifiable Headers. . . . . . . . . . . 17 3.2.1. Request Cache-Control Directives . . . . . . .20 7.3. Combining Headers. . . . 18 3.2.2. Response Cache-Control Directives . . . . . . . . . . 20 3.2.3. Cache Control Extensions . . . . . .21 8. Caching Negotiated Responses. . . . . . . . . 22 3.3. Expires . . . . . . . .22 9. Shared and Non-Shared Caches. . . . . . . . . . . . . . . . . 2310. Errors or Incomplete Response Cache Behavior3.4. Pragma . . . . . . . . .24 11. Side Effects of GET and HEAD. . . . . . . . . . . . . . . . .24 12. Invalidation After Updates or Deletions23 3.5. Vary . . . . . . . . . . .24 13. Write-Through Mandatory. . . . . . . . . . . . . . . . 24 3.6. Warning . . .25 14. Cache Replacement. . . . . . . . . . . . . . . . . . . . . .26 15.25 4. History Lists . . . . . . . . . . . . . . . . . . . . . . . .26 16. Header Field Definitions . . . . . . . .28 5. IANA Considerations . . . . . . . . . . .27 16.1. Age. . . . . . . . . . 28 5.1. Message Header Registration . . . . . . . . . . . . . . . 28 6. Security Considerations . .27 16.2. Cache-Control. . . . . . . . . . . . . . . . . 29 7. Acknowledgments . . . . .27 16.2.1. What is Cacheable. . . . . . . . . . . . . . . . . . 2916.2.2. What May be Stored by Caches . . . . . . . . . . . . 30 16.2.3. Modifications of the Basic Expiration Mechanism . . . 31 16.2.4. Cache Revalidation and Reload Controls8. References . . . . . . .33 16.2.5. No-Transform Directive. . . . . . . . . . . . . . .35 16.2.6. Cache Control Extensions. . . . 29 8.1. Normative References . . . . . . . . . .36 16.3. Expires. . . . . . . . . 29 8.2. Informative References . . . . . . . . . . . . . . . .37 16.4. Pragma. . 30 Appendix A. Compatibility with Previous Versions . . . . . . . . 31 A.1. Changes from RFC 2068 . . . . . . . . . . . . . . . .38 16.5. Vary. . 31 A.2. Changes from RFC 2616 . . . . . . . . . . . . . . . . . . 31 Appendix B. Collected ABNF . . . . . . .38 16.6. Warning. . . . . . . . . . . . 31 Appendix C. Change Log (to be removed by RFC Editor before publication) . . . . . . . . . . . . .39 17. IANA Considerations. . . . . . . 33 C.1. Since RFC2616 . . . . . . . . . . . . . .42 17.1. Message Header Registration. . . . . . . . 33 C.2. Since draft-ietf-httpbis-p6-cache-00 . . . . . . .42 18. Security Considerations. . . . 33 C.3. Since draft-ietf-httpbis-p6-cache-01 . . . . . . . . . . . 34 C.4. Since draft-ietf-httpbis-p6-cache-02 . . . .42 19. Acknowledgments. . . . . . . 34 C.5. Since draft-ietf-httpbis-p6-cache-03 . . . . . . . . . . . 34 C.6. Since draft-ietf-httpbis-p6-cache-04 . . . . .43 20. References. . . . . . 35 C.7. Since draft-ietf-httpbis-p6-cache-05 . . . . . . . . . . . 35 Index . . . . . . . . .43 20.1. Normative References. . . . . . . . . . . . . . . . . . .43 20.2. Informative References. . 35 Authors' Addresses . . . . . . . . . . . . . . . .44 Appendix A. Compatibility with Previous Versions. . . . . . . .44 A.1. Changes from RFC 2068 . . . . . . . . . . . . . . . . . . 44 A.2. Changes from RFC 2616 . . . . . . . . . . . . . . . . . . 45 Appendix B. Change Log (to be removed by RFC Editor before publication) . . . . . . . . . . . . . . . . . . . . 45 B.1. Since RFC2616 . . . . . . . . . . . . . . . . . . . . . . 45 B.2. Since draft-ietf-httpbis-p6-cache-00 . . . . . . . . . . . 45 B.3. Since draft-ietf-httpbis-p6-cache-01 . . . . . . . . . . . 46 B.4. Since draft-ietf-httpbis-p6-cache-02 . . . . . . . . . . . 46 B.5. Since draft-ietf-httpbis-p6-cache-03 . . . . . . . . . . . 46 B.6. Since draft-ietf-httpbis-p6-cache-04 . . . . . . . . . . . 47 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 49 Intellectual Property and Copyright Statements . . . . . . . . . . 5238 1. Introduction HTTP is typically used for distributed information systems, where performance can be improved by the use of responsecaches, and includes a numbercaches. This document defines aspects ofelements intended to make caching work as well as possible. Because these elements interact with each other, it is useful to describe the caching design of HTTP separately. This document defines aspects of HTTP/1.1 relatedHTTP/1.1 related to caching and reusing response messages. 1.1. Purpose An HTTP cache is a local store of response messages and the subsystem that controls its message storage, retrieval, and deletion. A cache stores cacheable responses in order to reduce the response time and network bandwidth consumption on future, equivalent requests. Any client or server may include a cache, though a cache cannot be used by a server that is acting as a tunnel. Caching would be useless if it did not significantly improve performance. The goal of caching in HTTP/1.1 is to reuse a prior response message to satisfy a current request. In some cases,the existinga stored response can be reused without the need for a network request, reducing latency and network round-trips;we use an "expiration"a "freshness" mechanism is used for this purpose (see Section4).2.3). Even when a new request is required, it is often possible to reuse all or parts of the payload of a prior response to satisfy the request, thereby reducing network bandwidth usage;we usea "validation" mechanism is used for this purpose (see Section5).2.4). 1.2. Terminology This specification uses a number of terms to refer to the roles played by participants in, and objects of, HTTP caching. cacheable Acache behaves inresponse is cacheable if a"semantically transparent" manner, with respectcache is allowed to store aparticular response,copy of the response message for use in answering subsequent requests. Even whenitsa response is cacheable, there may be additional constraints on whether a cache can useaffects neithertherequesting client norcached copy to satisfy a particular request. explicit expiration time The time at which the originserver, except to improve performance. Whenserver intends that an entity should no longer be returned by a cache without further validation. heuristic expiration time An expiration time assigned by a cache when no explicit expiration time issemantically transparent, the client receives exactly the sameavailable. age The age of a responsestatus and payload thatis the time since itwould have received had its request been handled directly bywas sent by, or successfully validated with, the origin server.In an ideal world, all interactions with an HTTP cache would be semantically transparent. However, for some resources, semantic transparencyfirst-hand A response is first-hand if the freshness model is notalways necessary and can be effectively traded forin use; i.e., its age is 0. freshness lifetime The length of time between thesakegeneration ofbandwidth scaling, disconnected operation, and high availability. HTTP/1.1 allows origin servers, caches, and clients to explicitly reduce transparency when necessary. However, because non- transparent operation may confuse non-expert usersa response andmight be incompatible with certain server applications (such as those for ordering merchandise), the protocol requires that transparency be relaxed o only by anits expiration time. fresh A response is fresh if its age has not yet exceeded its freshness lifetime. stale A response is stale if its age has passed its freshness lifetime (either explicitprotocol-level request when relaxed by clientororigin server o only withheuristic). validator A protocol element (e.g., anexplicit warning to the end user when relaxed by cacheentity tag orclient Therefore, HTTP/1.1 provides these important elements: 1. Protocol featuresa Last-Modified time) thatprovide full semantic transparency when thisisrequired by all parties. 2. Protocol features that allow an origin server or user agentused toexplicitly request and control non-transparent operation. 3. Protocol features that allowfind out whether a stored response is an equivalent copy of an entity. shared cache A cacheto attach warnings to responsesthatdo not preserve the requested approximation of semantic transparency.is accessible to more than one user. Abasic principlenon-shared cache isthat it must be possible for the clientsdedicated todetect any potential relaxation of semantic transparency. Note:a single user. 1.3. Requirements Theserver, cache, or client implementor might be faced with design decisions not explicitly discussedkey words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in thisspecification. If a decision might affect semantic transparency, the implementor oughtdocument are toerr on the side of maintaining transparency unless a careful and complete analysis shows significant benefitsbe interpreted as described inbreaking transparency. 1.2. Terminology This specification uses a number of terms to refer to the roles played by participants in, and objects of, HTTP caching. cacheable A response[RFC2119]. An implementation iscacheablenot compliant ifa cache is allowedit fails tostore a copysatisfy one or more of theresponse message for use in answering subsequent requests. Even when a response is cacheable, there may be additional constraints on whether a cache can use the cached copy for a particular request. first-hand A response is first-hand if it comes directly and without unnecessary delay from the origin server, perhaps via one or more proxies. A response is also first-hand if its validity has just been checked directly with the origin server. explicit expiration time The time at which the origin server intends that an entity should no longer be returned by a cache without further validation. heuristic expiration time An expiration time assigned by a cache when no explicit expiration time is available. age The age of a response is the time since it was sent by, or successfully validated with, the origin server. freshness lifetime The length of time between the generation of a response and its expiration time. fresh A response is fresh if its age has not yet exceeded its freshness lifetime. stale A response is stale if its age has passed its freshness lifetime. validator A protocol element (e.g., an entity tag or a Last-Modified time) that is used to find out whether a cache entry is an equivalent copy of an entity. 1.3. Requirements 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 [RFC2119]. An implementation is not compliant if it fails to satisfy one or more of the MUST or REQUIRED level requirementsMUST or REQUIRED level requirements for the protocols it implements. An implementation that satisfies all the MUST or REQUIRED level and all the SHOULD level requirements for its protocols is said to be "unconditionally compliant"; one that satisfies all the MUST level requirements but not all the SHOULD level requirements for its protocols is said to be "conditionally compliant."2. Notational Conventions and Generic Grammar1.4. Syntax Notation This specification uses the ABNF syntax defined in Section2.11.2 of [Part1]and(which extends thecore rulessyntax defined inSection 2.2 of [Part1]: DIGIT = <DIGIT,[RFC5234] with a list rule). Appendix B shows the collected ABNF, with the list rule expanded. The following core rules are included by reference, as defined in[Part1], Section 2.2>[RFC5234], Appendix B.1: ALPHA (letters), CR (carriage return), CRLF (CR LF), CTL (controls), DIGIT (decimal 0-9), DQUOTE= <DQUOTE, defined in [Part1], Section 2.2>(double quote), HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), OCTET (any 8-bit sequence of data), SP= <SP,(space), VCHAR (any visible USASCII character), and WSP (whitespace). 1.4.1. Core Rules The core rules below are defined in[Part1],Section2.2>1.2.2 of [Part1]: quoted-string = <quoted-string, defined in [Part1], Section2.2>1.2.2> token = <token, defined in [Part1], Section2.2>1.2.2> OWS = <OWS, defined in [Part1], Section2.2>1.2.2> 1.4.2. ABNF Rules defined in other Parts of the Specification The ABNF rules below are defined in other parts: field-name = <field-name, defined in [Part1], Section 4.2> HTTP-date = <HTTP-date, defined in [Part1], Section3.3.1>3.2.1> port = <port, defined in [Part1], Section3.2>2.1> pseudonym = <pseudonym, defined in [Part1], Section 8.9> uri-host = <uri-host, defined in [Part1], Section3.2> 3. Overview 3.1.2.1> 2. CacheCorrectnessOperation 2.1. Response Cacheability Acorrectcache MUSTrespond toNOT store arequest with the most up-to-dateresponseheld by the cache that is appropriatetotheany request, unless: o The request(see Sections 4.5, 4.6,method is defined as being cacheable, and14) which meets one of the following conditions: 1. It has been checked for equivalence with what the origin server would have returned by revalidating the response witho theorigin server (Section 5); 2. It is "fresh enough""no-store" cache directive (see Section4). In the default case, this means it meets the least restrictive freshness requirement of the client, origin server,3.2) does not appear in request or response headers, and o the "private" cache response directive (see Section16.2);3.2 does not appear in the response, if theorigin server so specifies, itcache is shared, and o thefreshness requirement"Authorization" header (see Section 3.1 ofthe origin server alone. If a stored response is[Part7]) does not"fresh enough" by the most restrictive freshness requirement of both the client and the origin server,appear incarefully considered circumstancesthecache MAY still returnrequest, if theresponse withcache is shared (unless theappropriate Warning header (see Sections 3.5 and 16.6), unless such a response"public" directive isprohibited (e.g., by a "no-store" cache- directive, or by a "no-cache" cache-request-directive;present; see Section16.2). 3. It is an appropriate 304 (Not Modified), 305 (Use Proxy), or error (4xx or 5xx) response message. If the cache can not communicate with3.2), and o theorigin server, then a correctcacheSHOULD respond as aboveunderstands partial responses, if the responsecan be correctly served from the cache; if not it MUST return an erroris partial orwarning indicatingincomplete (see Section 2.1.1). Note thatthere wasin normal operation, most caches will not store acommunication failure. Ifresponse that has neither a cachereceives a response (eithervalidator nor anentire response, or a 304 (Not Modified) response) that it would normally forwardexplicit expiration time, as such responses are not usually useful tothe requesting client,store. However, caches are not prohibited from storing such responses. 2.1.1. Storing Partial andthe receivedIncomplete Responses A cache that receives an incomplete responseis no longer fresh,(for example, with fewer bytes of data than specified in a Content-Length header) can store thecache SHOULD forwardresponse, but MUST treat ittoas a partial response [Part5]. Partial responses can be combined as described in Section 4 of [Part5]; therequesting client without addingresult might be anew Warning (but without removing any existing Warning headers).full response or might still be partial. A cacheSHOULDMUST NOTattempt to revalidatereturn a partial responsesimply because that response became stale in transit; this might leadtoan infinite loop. A user agent that receivesastale responseclient withouta Warning MAY display a warning indication toexplicitly marking it as such using theuser. 3.2. Warnings Whenever a206 (Partial Content) status code. A cachereturns a responsethatis neither first-hand nor "fresh enough" (indoes not support thesense of condition 2 in Section 3.1), itRange and Content-Range headers MUSTattachNOT store incomplete or partial responses. 2.2. Constructing Responses from Caches For awarning to that effect, usingpresented request, aWarning general-header.cache MUST NOT return a stored response, unless: o TheWarning headerpresented Request-URI and that of thecurrently defined warnings are described in Section 16.6. The warning allows clients to take appropriate action. Warnings MAYstored response match (see [[anchor1: TBD]]), and o the request method associated with the stored response allows it to be used forother purposes, both cache-relatedthe presented request, andotherwise. The use of a warning, rather than an error status code, distinguish these responses from true failures. Warnings are assigned three digit warn-codes. The first digit indicates whethero selecting request-headers nominated by theWarning MUST or MUST NOT be deleted from astoredcache entry after a successful revalidation: 1xx Warnings that describe the freshness or revalidation status ofresponse (if any) match those presented (see Section 2.6), and o theresponse,presented request andso MUST be deleted after a successful revalidation. 1xx warn-codes MAY be generated by a cache only when validating a cached entry. It MUST NOT be generated by clients. 2xx Warningsstored response are free from directives thatdescribe some aspect ofwould prevent its use (see Section 3.2 and Section 3.4), and o theentity body or entity headers thatstored response isnot rectified byeither: * fresh (see Section 2.3), or * allowed to be served stale (see Section 2.3.3), or * successfully validated (see Section 2.4). [[anchor2: TODO: define method cacheability for GET, HEAD and POST in p2-semantics.]] When arevalidation (for example,stored response is used to satisfy alossy compression of the entity bodies) and whichrequest, caches MUSTNOT be deleted afterinclude asuccessful revalidation. Seesingle Age header field Section16.6 for the definitions of the codes themselves. HTTP/1.0 caches will cache all Warnings3.1 inresponses, without deletingtheones inresponse with a value equal to thefirst category. Warnings in responsesstored response's current_age; see Section 2.3.2. [[anchor3: DISCUSS: this currently includes successfully validated responses.]] Requests with methods that arepassedunsafe (Section 7.1.1 of [Part2]) MUST be written through the cache toHTTP/1.0 caches carry an extra warning-date field, which prevents a future HTTP/1.1 recipient from believing an erroneously cached Warning. Warnings also carrythe origin server; i.e., A cache must not reply to such awarning text. The text MAY be in any appropriate natural language (perhaps based onrequest before having forwarded theclient's Accept headers),request andinclude an OPTIONAL indication of what character set is used. Multiple warnings MAY be attached tohaving received aresponse (either bycorresponding response. Also, note that unsafe requests might invalidate already stored responses; see Section 2.5. Caches MUST use theorigin server ormost recent response (as determined bya cache), including multiple warnings withthesame code number. For example,Date header) when more than one suitable response is stored. They can also forward aserver might provide the same warningrequest withtexts in both English and Basque. When multiple warnings are attached to a response, it might not be practical"Cache-Control: max-age=0" orreasonable to display all of them"Cache- Control: no-cache" tothe user. This version of HTTP does not specify strict priority rules for decidingdisambiguate whichwarningsresponse todisplayuse. [[anchor4: TODO: end-to-end and hop-by-hop headers, non-modifiable headers removed; re-spec inwhat order, but does suggest some heuristics. 3.3. Cache-control Mechanisms The basic cache mechanismsp1]] 2.3. Freshness Model When a response is "fresh" inHTTP/1.1 (server-specified expiration times and validators) are implicit directivesthe cache, it can be used tocaches. In some cases, asatisfy subsequent requests without contacting the origin server, thereby improving efficiency. The primary mechanism for determining freshness is for an origin serveror client might needto provide an explicitdirectives toexpiration time in theHTTP caches. We usefuture, using either theCache-Control header for this purpose. The Cache-ControlExpires headerallows a client or server to transmit a variety of directives in either requests(Section 3.3) orresponses. These directives typically overridethedefault caching algorithms. As a general rule, if there is any apparent conflict between header values, the most restrictive interpretation is applied (that is,max-age response cache directive (Section 3.2.2). Generally, origin servers will assign future explicit expiration times to responses in theonebelief that the entity ismostnot likely topreserve semantic transparency). However, in some cases, cache-control directives are explicitly specified as weakening the approximation of semantic transparency (for example, "max-stale" or "public"). The cache-control directives are described in detailchange inSection 16.2. 3.4. Explicit User Agent Warnings Many user agents make it possible for users to override the basic caching mechanisms. For example, the user agent might allowa semantically significant way before theuserexpiration time is reached. If an origin server wishes tospecify that cached entities (even explicitly stale ones) are never validated. Or the user agent might habitually add "Cache- Control: max-stale=3600"force a cache to validate everyrequest. The user agent SHOULD NOT default to either non-transparent behavior, or behavior that results in abnormally ineffective caching, but MAY be explicitly configured to do so byrequest, it can assign an explicitaction of the user. If the user has overridden the basic caching mechanisms, the user agent SHOULD explicitly indicate to the user whenever this resultsexpiration time in thedisplay of informationpast. This means thatmight not meet the server's transparency requirements (in particular, ifthedisplayed entityresponse isknown to be stale). Since the protocol normally allowsalways stale, so that caches should validate it before using it for subsequent requests. [[anchor5: This wording may cause confusion, because theuser agent to determine if responses are stale or not, this indication need onlyresponse may still bedisplayedserved stale.]] Since origin servers do not always provide explicit expiration times, HTTP caches may also assign heuristic expiration times whenthis actually happens. The indication needthey are notbe a dialog box; it could be an icon (for example, a picture of a rotting fish) or some other indicator. If the user has overridden the caching mechanisms in a wayspecified, employing algorithms thatwould abnormally reduce the effectiveness of caches,use other header values (such as theuser agent SHOULD continually indicate this stateLast-Modified time) tothe user (for example, by a display ofestimate apicture of currency in flames) so that the userplausible expiration time. The HTTP/1.1 specification does notinadvertently consume excess resources or suffer from excessive latency. 3.5. Exceptionsprovide specific algorithms, but does impose worst-case constraints on their results. The calculation tothe Rules and Warnings In some cases, the operator ofdetermine if acache MAY choose to configure it to return stale responses even when not requested by clients. This decision ought not be made lightly, but may be necessary for reasons of availability or performance, especially whenresponse is fresh is: response_is_fresh = (freshness_lifetime > current_age) The freshness_lifetime is defined in Section 2.3.1; thecachecurrent_age ispoorly connecteddefined in Section 2.3.2. Additionally, clients may need tothe origin server. Whenever ainfluence freshness calculation. They can do this using several request cachereturns a stale response, it MUST mark it as such (using a Warning header) enablingdirectives, with theclient softwareeffect of either increasing or loosening constraints on freshness. See Section 3.2.1. [[anchor6: ISSUE: there are not requirements directly applying toalert the usercache-request-directives and freshness.]] Note thatthere mightfreshness applies only to cache operation; it cannot be used to force apotential problem. It also allows theuser agent totake steps to obtain a first-handrefresh its display orfresh response. For this reason,reload a resource. See Section 4 for an explanation of the difference between caches and history mechanisms. 2.3.1. Calculating Freshness Lifetime A cacheSHOULD NOT returncan calculate the freshness lifetime (denoted as freshness_lifetime) of astaleresponseifby using theclient explicitly requests a first-hand or fresh one, unless itfirst match of: o If the cache isimpossible to comply for technicalshared and the s-maxage response cache directive (Section 3.2.2) is present, use its value, orpolicy reasons. 3.6. Client-controlled Behavior Whileo If theorigin server (and to a lesser extent, intermediate caches, by their contribution tomax-age response cache directive (Section 3.2.2) is present, use its value, or o If theage of a response) areExpires response header (Section 3.3) is present, use its value minus theprimary sourcevalue of the Date response header, or o Otherwise, no explicit expirationinformation,time is present insome casestheclient might need to control a cache's decision about whether to returnresponse, but acached response without validating it. Clients doheuristic may be used; see Section 2.3.1.1. Note that thisusing several directives of the Cache-Control header. A client's request MAY specify the maximum age itcalculation iswilling to accept of an unvalidated response; specifying a value of zero forces the cache(s)not vulnerable torevalidateclock skew, since allresponses. A client MAY also specify the minimum time remaining before a response expires. Both of these options increase constraints on the behavior of caches, and so cannot further relax the cache's approximation of semantic transparency. A client MAY also specify that it will accept stale responses, up to some maximum amountofstaleness. This loosens the constraints on the caches, and so might violate the origin server's specified constraints on semantic transparency, but might be necessary to support disconnected operation, or high availability intheface of poor connectivity. 4. Expiration Model 4.1. Server-Specified Expiration HTTP caching works best when caches can entirely avoid making requests toinformation comes from the origin server.The primary mechanism for avoiding requests is for an origin server to provide an2.3.1.1. Calculating Heuristic Freshness If no explicit expiration time is present inthe future, indicating thata stored responseMAY be used to satisfy subsequent requests. In other words,that has acache can returnstatus code of 200, 203, 206, 300, 301 or 410, afresh response without first contacting the server. Our expectation is that servers will assign future explicit expiration times to responses in the belief that the entity is not likely to change, in a semantically significant way, before theheuristic expiration timeis reached. This normally preserves semantic transparency, as long as the server's expiration times are carefully chosen. The expiration mechanism applies only to responses taken fromcan be calculated. Heuristics MUST NOT be used for other response status codes. When acache and not to first-hand responses forwarded immediatelyheuristic is used to calculate freshness lifetime, therequesting client. If an origin server wishes to force a semantically transparentcache SHOULD attach a Warning header with a 113 warn-code tovalidate every request, it MAY assign an explicit expiration time in the past. This means thatthe response if its current_age isalways stale,more than 24 hours andsosuch a warning is not already present. Also, if thecache SHOULD validate it before using it for subsequent requests. See Section 16.2.4 forresponse has a Last-Modified header (Section 6.6 of [Part4]), the heuristic expiration value SHOULD be no morerestrictive way to force revalidation. If an origin server wishes to force anythan some fraction of the interval since that time. A typical setting of this fraction might be 10%. [[anchor7: REVIEW: took away HTTP/1.0 query string heuristic uncacheability.]] 2.3.2. Calculating Age HTTP/1.1cache, no matter how it is configured,uses the Age response-header tovalidate every request, it SHOULD useconvey the"must- revalidate" cache-control directive (see Section 16.2). Servers specify explicit expiration times using eitherestimated age of theExpires header, orresponse message when obtained from a cache. The Age field value is themax-age directivecache's estimate of theCache-Control header. An expirationamount of timecannot be used to force a user agent to refresh its displaysince the response was generated orreload a resource; its semantics apply only to caching mechanisms, and such mechanisms need only check a resource's expiration status when a new request for that resourcevalidated by the origin server. In essence, the Age value isinitiated. See Section 15 for an explanationthe sum of the time that the response has been resident in each of thedifference betweencachesand history mechanisms. 4.2. Heuristic Expiration Sincealong the path from the originservers do not always provide explicit expiration times, HTTP caches typically assign heuristic expiration times, employing algorithms that use other header values (such asserver, plus theLast-Modified time) to estimate a plausible expiration time.amount of time it has been in transit along network paths. The term "age_value" denotes the value of the Age header, in a form appropriate for arithmetic operations. HTTP/1.1specification does not provide specific algorithms, but does impose worst-case constraints on their results. Since heuristic expiration times might compromise semantic transparency, they ought to be used cautiously, and we encouragerequires origin servers toprovide explicit expiration times as much as possible. 4.3. Age Calculations In order to know if a cached entry is fresh,send acache needs to knowDate header, ifits age exceeds its freshness lifetime. We discuss how to calculatepossible, with every response, giving thelatter intime at which the response was generated (see Section4.4; this section describes how to calculate8.3 of [Part1]). The term "date_value" denotes theagevalue ofa response or cache entry. In this discussion, we usethe Date header, in a form appropriate for arithmetic operations. The term "now"to meanmeans "the current value of the clock at the host performing the calculation." Hosts that use HTTP, but especially hosts running origin servers and caches, SHOULD use NTP [RFC1305] or some similar protocol to synchronize their clocks to a globally accurate time standard.HTTP/1.1 requires origin servers to send a Date header, if possible, with every response, giving the time at which the response was generated (see Section 8.3 of [Part1]). We use the term "date_value" to denote the value of the Date header, in a form appropriate for arithmetic operations. HTTP/1.1 uses the Age response-header to convey the estimated age of the response message when obtained from a cache. The Age field value is the cache's estimate of the amount of time since the response was generated or revalidated by the origin server. In essence, the Age value is the sum of the time that the response has been resident in each of the caches along the path from the origin server, plus the amount of time it has been in transit along network paths. We use the term "age_value" to denote the value of the Age header, in a form appropriate for arithmetic operations.A response's age can be calculated in two entirely independent ways: 1. now minus date_value, if the local clock is reasonably well synchronized to the origin server's clock. If the result is negative, the result is replaced by zero. 2. age_value, if all of the caches along the response path implement HTTP/1.1.Given that we have two independent ways to compute the age of a response when it is received, we can combine theseThese are combined as corrected_received_age = max(now - date_value, age_value)and as long as we have either nearly synchronized clocks or all- HTTP/1.1 paths, one gets a reliable (conservative) result. Because of network-imposed delays, some significant interval might pass between the time that a server generates a response and the time it is received at the next outbound cache or client. If uncorrected, this delay could result in improperly low ages. Because the request that resulted in the returned Age value must have been initiated prior to that Age value's generation, we can correct for delays imposed by the network by recording the time at which the request was initiated. Then, whenWhen an Age value is received, it MUST be interpreted relative to the time the request was initiated, not the time that the response was received.This algorithm results in conservative behavior no matter how much delay is experienced. So, we compute:corrected_initial_age = corrected_received_age + (now - request_time) where "request_time" is the time (according to the local clock) when the request that elicited this response was sent.SummaryThe current_age ofage calculation algorithm, when a cache receivesaresponse: /* * age_value * is the value of Age: header receivedstored response can then be calculated by adding thecache with * this response. * date_value * is the valueamount of time (in seconds) since the stored response was last validated by the originserver's Date:server to the corrected_initial_age. In summary: age_value - Age header* request_time * isfield-value received with the response date_value - Date header field-value received with the(local)response request_time - local time when the cache made the request* that resultedresulting inthis cachedthe stored response*response_time* is the (local)- local time when the cache received the*response*now* is the- current(local)local time*/apparent_age = max(0, response_time - date_value); corrected_received_age = max(apparent_age, age_value); response_delay = response_time - request_time; corrected_initial_age = corrected_received_age + response_delay; resident_time = now - response_time; current_age = corrected_initial_age + resident_time;The current_age of a cache entry2.3.3. Serving Stale Responses A "stale" response iscalculated by adding the amount of time (in seconds) since the cache entry was last validated by the origin serverone that either has explicit expiry information, or is allowed to have heuristic expiry calculated, but is not fresh according to thecorrected_initial_age. Whencalculations in Section 2.3. Caches MUST NOT return a stale response if it isgenerated fromprohibited by an explicit in-protocol directive (e.g., by a "no-store" or "no-cache" cacheentry,directive, a "must-revalidate" cache-response-directive, or an applicable "s-maxage" or "proxy-revalidate" cache-response-directive; see Section 3.2.2). Caches SHOULD NOT return stale responses unless they are disconnected (i.e., it cannot contact thecache MUST includeorigin server or otherwise find asingle Age header field inforward path) or otherwise explicitly allowed (e.g., theresponse withmax-stale request directive; see Section 3.2.1). Stale responses SHOULD have avalue equal toWarning header with the 110 warn-code (see Section 3.6). Likewise, the 112 warn-code SHOULD be sent on stale responses if the cacheentry's current_age. The presence of an Age header field inis disconnected. If aresponse implies thatcache receives a first-hand responseis not first-hand. However, the converse is not true, since the lack of(either anAge header field in a response does not implyentire response, or a 304 (Not Modified) response) that it would normally forward to the requesting client, and the received response isfirst-hand unless all caches alongno longer fresh, therequest path are compliant with HTTP/1.1 (i.e., older HTTP caches did not implementcache SHOULD forward it to theAge header field). 4.4. Expiration Calculations In orderrequesting client without adding a new Warning (but without removing any existing Warning headers). A cache SHOULD NOT attempt todecide whethervalidate a responseis fresh or stale, we need to compare its freshness lifetime to its age. The age is calculated as describedsimply because that response became stale inSection 4.3; this section describes how to calculatetransit. 2.4. Validation Model Checking with thefreshness lifetime, andorigin server todeterminesee if a stale or otherwise unusable cached responsehas expired. In the discussion below, the valuescan berepresented in any form appropriate for arithmetic operations. We use the term "expires_value" to denotereused is called "validating" or "revalidating." Doing so potentially avoids thevalueoverhead of retransmitting theExpires header. We use the term "max_age_value" to denote an appropriate value ofresponse body when thenumber of seconds carried bystored response is valid. HTTP's conditional request mechanism [Part4] is used for this purpose. When a stored response includes one or more validators, such as the"max-age" directivefield values ofthe Cache-Controlan ETag or Last-Modified headerinfield, then a validating request SHOULD be made conditional to those field values. A 304 (Not Modified) response(seestatus code indicates that the stored response can be updated and reused; see Section16.2.3). The max-age directive takes priority over Expires, so if max-age is present in a response,2.7. If instead thecalculationcache receives a full response (i.e., one with a response body), it issimply: freshness_lifetime = max_age_value Otherwise, if Expires is present in the response, the calculation is: freshness_lifetime = expires_value - date_value Note that neither of these calculations is vulnerableused toclock skew, since all of the information comes from the origin server. If none of Expires, Cache-Control: max-age, or Cache-Control: s-maxage (see Section 16.2.3) appears insatisfy theresponse,request and replace theresponse does not include other restrictions on caching, the cache MAY computestored response. [[anchor8: Should there be afreshness lifetime usingrequirement here?]] If aheuristic. ThecacheMUST attach Warning 113 to any response whose age is more than 24 hours if such warning has not already been added. Also, if thereceives a 5xx responsedoes havewhile attempting to validate aLast-Modified time, the heuristic expiration value SHOULD be no more than some fraction of the interval since that time. A typical setting ofresponse, it MAY either forward thisfraction might be 10%. The calculationresponse todeterminethe requesting client, or act as ifa response has expired is quite simple: response_is_fresh = (freshness_lifetime > current_age) 4.5. Disambiguating Expiration Values Because expiration values are assigned optimistically, it is possible for two cachesthe server failed tocontain fresh values forrespond. In thesame resource that are different. If a client performing a retrieval receiveslatter case, it MAY return anon-first-handpreviously stored responsefor a request that was already fresh in its own cache, and the Date header in its existing cache entry is newer than the Date on the new response, then(which SHOULD include theclient MAY ignore111 warn-code; see Section 3.6) unless theresponse. If so, it MAY retrystored response includes therequest with a "Cache-Control: max-age=0""must-revalidate" cache directive (see Section16.2), to force a check with2.3.3). 2.5. Request Methods that Invalidate Because unsafe methods (Section 7.1.1 of [Part2]) have theorigin server. If a cache has two fresh responsespotential for changing state on thesame representation with different validators, it MUSTorigin server, intervening caches can use them to keep their contents up-to-date. The following HTTP methods MUST cause a cache to invalidate theone withRequest-URI as well as themore recent Date header. This situation might arise becauseLocation and Content-Location headers (if present): o PUT o DELETE o POST An invalidation based on thecache is pooling responses from other caches, or because a client has asked forURI in areloadLocation ora revalidationContent-Location header MUST NOT be performed if the host part ofan apparently fresh cache entry. 4.6. Disambiguating Multiple Responses Because a client mightthat URI differs from the host part in the Request-URI. This helps prevent denial of service attacks. [[anchor9: TODO: "host part" needs to bereceiving responses via multiple paths, sospecified better.]] A cache thatsome responses flowpasses throughone set of caches and otherrequests for methods it does not understand SHOULD invalidate the Request-URI. Here, "invalidate" means that the cache will either remove all stored responsesflow through a different setrelated to the Request-URI, or will mark these as "invalid" and in need ofcaches,aclient might receive responses in an order different from thatmandatory validation before they can be returned inwhich the origin server sent them. We would like the clientresponse touse the most recently generated response, even if oldera subsequent request. Note that this does not guarantee that all appropriate responses arestill apparently fresh. Neither the entity tag norinvalidated. For example, theexpiration value can impose an ordering on responses, since it is possiblerequest that caused the change at the origin server might not have gone through the cache where alaterresponseintentionally carries an earlier expiration time. The Date values are ordered to a granularityis stored. [[anchor10: TODO: specify that only successful (2xx, 3xx?) responses invalidate.]] 2.6. Caching Negotiated Responses Use ofone second. When a client tries to revalidateserver-driven content negotiation (Section 4.1 of [Part3]) alters the conditions under which a cacheentry, andcan use the responseitfor subsequent requests. When a cache receivescontainsaDate headerrequest thatappears tocan beolder thansatisfied by a stored response that includes a Vary header field (Section 3.5), it MUST NOT use that response unless all of theone forselecting request-headers in theexisting entry, thenpresented request match theclient SHOULD repeatcorresponding stored request-headers from therequest unconditionally, and include Cache-Control: max-age=0original request. The selecting request-headers from two requests are defined toforce any intermediate cachesmatch if and only if the selecting request-headers in the first request can be transformed tovalidate their copies directly withtheorigin server,selecting request-headers in the second request by adding orCache-Control: no-cacheremoving linear white space [[anchor11: [ref]]] at places where this is allowed by the corresponding ABNF, and/or combining multiple message-header fields with the same field name following the rules about message headers in Section 4.2 of [Part1]. [[anchor12: DISCUSS: header-specific canonicalisation]] A Vary header field-value of "*" always fails toforce any intermediate cachesmatch, and subsequent requests toobtain a new copy fromthat resource can only be properly interpreted by the origin server. If no stored response matches, theDate values are equal, then the clientcache MAYuse either response (or MAY, if it is being extremely prudent,forward the presented requesta new response). Servers MUST NOT depend on clients being abletochoose deterministically between responses generated duringthesame second, if their expiration times overlap. 5. Validation Model When a cache hasorigin server in astale entry that it would like to use as a response to a client'sconditional request,it first has to checkand SHOULD include all ETags stored with potentially suitable responses in an If-None-Match request header. If theoriginserver(or possibly an intermediate cacheresponds witha fresh response)304 (Not Modified) and includes an entity tag or Content-Location that indicates the entity tosee if itsbe used, that cachedentry is still usable. We call this "validating"response MUST be used to satisfy thecache entry. HTTP's conditional request mechanism, defined in [Part4], ispresented request, and SHOULD be used toavoid retransmittingupdate theresponse payload whencorresponding stored response; see Section 2.7. If any of thecached entrystored responses contains only partial content, its entity-tag SHOULD NOT be included in the If-None-Match header field unless the request isvalid. Whenfor acachedrange that would be fully satisfied by that stored response. If a cache receives a successful responseincludes one or more "cache validators," such as thewhose Content-Location fieldvaluesmatches that of anETag or Last-Modified header field, then a validating GET request SHOULD be made conditional to those field values. The server checksexisting stored response for theconditional request's validator againstsame Request-URI, whose entity-tag differs from that of thecurrent stateexisting stored response, and whose Date is more recent than that of therequested resource and, if they match,existing response, theserver responds withexisting response SHOULD NOT be returned in response to future requests and SHOULD be deleted from the cache.[[anchor13: DISCUSS: Not sure if this is necessary.]] 2.7. Combining Responses When a cache receives a 304 (Not Modified)status coderesponse or a 206 (Partial Content) response, it needs toindicateupdate the stored response with the new one, so that thecachedupdated response can berefreshed and reused without retransmittingsent to theresponse payload.client. If thevalidator does not matchstatus code is 304 (Not Modified), thecurrent state ofcache SHOULD use therequested resource, thenstored entity-body as theserver returns a full response, including payload, so thatupdated entity-body. If therequest can be satisfiedstatus code is 206 (Partial Content) and thecache entry supplanted withoutETag or Last-Modified headers match exactly, theneed for an additional network round-trip. 6. Response Cacheability Unless specifically constrained by a cache-control (Section 16.2) directive, a caching systemcache MAYalways store a successfulcombine the stored entity-body in the stored response with the updated entity-body received in the response and use the result as the updated entity-body (see Section10) as a cache entry, MAY return it without validation if it is fresh, and MAY return it after successful validation. If there is neither a cache validator nor an explicit expiration time associated with a4 of [Part5]). The stored response headers are used for the updated response,we do not expect it to be cached, but certain caches MAY violate this expectation (for example, when little or no network connectivity is available). A client can usually detectexcept thatsuch a response was takeno any stored Warning headers with warn-code 1xx (see Section 3.6) MUST be deleted froma cache by comparingtheDate header tostored response and thecurrent time. Note: some HTTP/1.0 caches are known to violate this expectation without providingforwarded response. o anyWarning. However, in some cases it mightstored Warning headers with warn-code 2xx MUST beinappropriate for a cache to retain an entity, or to return itretained in the stored responseto a subsequent request. This might be because absolute semantic transparency is deemed necessary byand theservice author, or because of security or privacy considerations. Certain cache-control directives are thereforeforwarded response. o any headers providedso thatin theserver can indicate that certain resource entities,304 orportions thereof, are not to be cached regardless of other considerations. Note that Section 4.1 of [Part7] normally prevents a shared cache from saving and returning a response to a previous request if that request included an Authorization header. A206 responsereceived with a status code of 200, 203, 206, 300, 301 or 410 MAY be stored by a cache and used in reply to a subsequent request, subject to the expiration mechanism, unless a cache-control directive prohibits caching. However, a cache that does not supportMUST replace theRange and Content-Rangecorresponding headersMUST NOT cache 206 (Partial Content) responses.from the stored response. Aresponse received with any other status code (e.g. status codes 302 and 307)cache MUSTNOT be returnedalso replace any stored headers with corresponding headers received ina reply to a subsequent request unless there are cache-control directives or another header(s) that explicitly allow it. For example, these includethefollowing: an Expires header (Section 16.3);incoming response, except for Warning headers as described immediately above. If a"max-age", "s-maxage", "must- revalidate", "proxy-revalidate", "public" or "private" cache-control directive (Section 16.2). 7. Constructing Responses From Caches The purpose of an HTTP cache is to store information receivedheader field-name in the incoming responseto requests for usematches more than one header inrespondingthe stored response, all such old headers MUST be replaced. It MAY store the combined entity-body. [[anchor14: ISSUE: discuss how tofuture requests. In many cases, a cache simply returnshandle HEAD updates]] 3. Header Field Definitions This section defines theappropriate partssyntax and semantics ofa responseHTTP/1.1 header fields related to caching. For entity-header fields, both sender and recipient refer to either therequester. However, ifclient or thecache holdsserver, depending on who sends and who receives the entity. 3.1. Age The response-header field "Age" conveys the sender's estimate of the amount of time since the response (or its validation) was generated at the origin server. Age values are calculated as specified in Section 2.3.2. Age = "Age" ":" OWS Age-v Age-v = delta-seconds Age field-values are non-negative decimal integers, representing time in seconds. delta-seconds = 1*DIGIT If a cacheentry based onreceives aprevious response,value larger than the largest positive integer itmight have to combine partscan represent, or if any of its age calculations overflows, it MUST transmit an Age header with a field-value of 2147483648 (2^31). Caches SHOULD use an arithmetic type of at least 31 bits of range. The presence of an Age header field in a response implies that anewresponsewith whatisheld innot first-hand. However, thecache entry. 7.1. End-to-end and Hop-by-hop Headers Forconverse is not true, since HTTP/1.0 caches may not implement thepurpose of definingAge header field. 3.2. Cache-Control The general-header field "Cache-Control" is used to specify directives that MUST be obeyed by all caches along the request/ response chain. The directives specify behaviorof caches and non-caching proxies, we divide HTTP headers into two categories: o End-to-end headers, which are transmittedintended to prevent caches from adversely interfering with theultimate recipient of arequest or response.End-to-end headersCache directives are unidirectional inresponses MUST be stored as partthat the presence of acache entry and MUST be transmitteddirective inany response formed from a cache entry. o Hop-by-hop headers, which are meaningful only forasingle transport-level connection, and arerequest does notstored byimply that the same directive is to be given in the response. Note that HTTP/1.0 cachesor forwarded by proxies. The following HTTP/1.1 headers are hop-by-hop headers: o Connection o Keep-Alive o Proxy-Authenticate o Proxy-Authorization o TE o Trailer o Transfer-Encoding o Upgrade All other headers defined by HTTP/1.1 are end-to-end headers. Other hop-by-hop headersmight not implement Cache-Control and might only implement Pragma: no-cache (see Section 3.4). Cache directives MUST belisted inpassed through by aConnection header (Section 8.1 of [Part1]). 7.2. Non-modifiable Headers Some featuresproxy or gateway application, regardless ofHTTP/1.1, such as Digest Authentication, depend ontheir significance to that application, since thevalue of certain end-to-end headers. A transparent proxy SHOULDdirectives might be applicable to all recipients along the request/response chain. It is not possible to target a directive to a specific cache. Cache-Control = "Cache-Control" ":" OWS Cache-Control-v Cache-Control-v = 1#cache-directive cache-directive = cache-request-directive / cache-response-directive cache-extension = token [ "=" ( token / quoted-string ) ] 3.2.1. Request Cache-Control Directives cache-request-directive = "no-cache" / "no-store" / "max-age" "=" delta-seconds / "max-stale" [ "=" delta-seconds ] / "min-fresh" "=" delta-seconds / "no-transform" / "only-if-cached" / cache-extension no-cache The no-cache request directive indicates that a stored response MUST NOTmodify an end-to-end header unlessbe used to satisfy thedefinition ofrequest without successful validation on the origin server. no-store The no-store request directive indicates thatheader requires or specifically allows that. A transparent proxya cache MUST NOTmodifystore any part ofthe following fields in aeither this request orresponse,any response to it. This directive applies to both non-shared andit MUSTshared caches. "MUST NOTadd any of these fields if not already present: o Content-Location o Content-MD5 o ETag o Last-Modified A transparent proxystore" in this context means that the cache MUST NOTmodify any ofintentionally store thefollowing fieldsinformation in non-volatile storage, and MUST make aresponse: o Expires but it MAY add any of these fields if not already present. If an Expires header is added, it MUST be given a field-value identicalbest-effort attempt tothat ofremove theDate header in that response. A proxy MUSTinformation from volatile storage as promptly as possible after forwarding it. This directive is NOTmodify or add any of the following fields inamessage that contains the no-transform cache-control directive,reliable orin any request: o Content-Encoding o Content-Range o Content-Type A non-transparent proxy MAY modifysufficient mechanism for ensuring privacy. In particular, malicious oradd these fields to a message that does not include no-transform, but if it does so, it MUST add a Warning 214 (Transformation applied) if one does not already appear in the message (see Section 16.6). Warning: unnecessary modification of end-to-end headerscompromised caches mightcause authentication failures if stronger authentication mechanisms are introduced in later versions of HTTP. Such authentication mechanisms MAY rely on the values of header fieldsnotlisted here.recognize or obey this directive, and communications networks may be vulnerable to eavesdropping. max-age TheContent-Length field of amax-age requestor responsedirective indicates that the client isadded or deleted accordingwilling to accept a response whose age is no greater than therulesspecified time inSection 4.4 of [Part1]. A transparent proxy MUST preserve the entity-length (Section 4.2.2 of [Part3]) of the entity-body, although it MAY changeseconds. Unless max-stale directive is also included, thetransfer-length (Section 4.4 of [Part1]). 7.3. Combining Headers When a cache makes a validating requestclient is not willing to accept aserver, andstale response. max-stale The max-stale request directive indicates that theserver providesclient is willing to accept a304 (Not Modified)responseorthat has exceeded its expiration time. If max-stale is assigned a206 (Partial Content) response, the cachevalue, thenconstructsthe client is willing to accept a responseto send tothat has exceeded its expiration time by no more than therequesting client.specified number of seconds. Ifthe status codeno value is304 (Not Modified), the cache uses the entity- body stored in the cache entry asassigned to max-stale, then theentity-bodyclient is willing to accept a stale response ofthis outgoing response. Ifany age. [[anchor15: of any staleness? --mnot]] min-fresh The min-fresh request directive indicates that thestatus codeclient is206 (Partial Content) and the ETag or Last-Modified headers match exactly, the cache MAY combine the contents stored in the cache entry withwilling to accept a response whose freshness lifetime is no less than its current age plus thenew contents receivedspecified time in seconds. That is, the client wants a responseand use the result asthat will still be fresh for at least theentity-body of this outgoing response, (see Section 5specified number of[Part5]).seconds. no-transform Theend-to-end headers stored in the cache entry are used for the constructed response, exceptno-transform request directive indicates thato any stored Warning headers with warn-code 1xx (see Section 16.6)an intermediate cache or proxy MUSTbe deleted fromNOT change thecache entry andContent-Encoding, Content-Range or Content-Type request headers, nor theforwardedrequest entity-body. only-if-cached The only-if-cached request directive indicates that the client only wishes to return a stored response.o anyIf it receives this directive, a cache SHOULD either respond using a storedWarning headersresponse that is consistent withwarn-code 2xx MUST be retained in the cache entry andtheforwarded response. o any end-to-end headers provided inother constraints of the304request, or206 response MUST replace the corresponding headers from the cache entry. Unless the cache decides to removerespond with a 504 (Gateway Timeout) status. If a group of caches is being operated as a unified system with good internal connectivity, such a request MAY be forwarded within that group of caches. 3.2.2. Response Cache-Control Directives cache-response-directive = "public" / "private" [ "=" DQUOTE 1#field-name DQUOTE ] / "no-cache" [ "=" DQUOTE 1#field-name DQUOTE ] / "no-store" / "no-transform" / "must-revalidate" / "proxy-revalidate" / "max-age" "=" delta-seconds / "s-maxage" "=" delta-seconds / cache-extension public The public response directive indicates that thecache entry,response MAY be cached, even if itMUSTwould normally be non-cacheable or cacheable only within a non-shared cache. (See alsoreplaceAuthorization, Section 3.1 of [Part7], for additional details.) private The private response directive indicates that theend-to-end headersresponse message is intended for a single user and MUST NOT be storedwith theby a shared cache. A private (non-shared) cacheentry with corresponding headers received inMAY store theincoming response, except for Warning headers as described immediately above.response. Ifa header field- name intheincomingprivate responsematches more thandirective specifies oneheader inor more field- names, this requirement is limited to thecache entry, all such old headersfield-values associated with the listed response headers. That is, the specified field- names(s) MUST NOT bereplaced. In other words,stored by a shared cache, whereas thesetremainder ofend-to-end headers received intheincomingresponseoverrides all corresponding end-to-end headers stored with the cache entry (except for stored Warning headers with warn-code 1xx, which are deleted even if not overridden).message MAY be. Note:this rule allows an origin server to use a 304 (Not Modified) or a 206 (Partial Content)This usage of the word private only controls where the responseto update any header associated with a previousmay be stored, and cannot ensure the privacy of the message content. no-cache The no-cache responsefordirective indicates that thesame entity or sub- ranges thereof, although it might not alwaysresponse MUST NOT bemeaningful or correctused todo so.satisfy a subsequent request without successful validation on the origin server. Thisrule does not allowallows an origin server touse a 304 (Not Modified) or a 206 (Partial Content)prevent caching even by caches that have been configured to return stale responses. If the no-cache response directive specifies one or more field- names, this requirement is limited toentirely delete a header that it had providedthe field-values assosicated witha previous response. 8. Caching Negotiated Responses Use of server-driven content negotiation (Section 5.1 of [Part3]), as indicated bythepresence of a Vary header field in a response, alterslisted response headers. That is, theconditions and procedure by which a cache can usespecified field- name(s) MUST NOT be sent in the responseforto a subsequentrequests. See Section 16.5 for use ofrequest without successful validation on theVary header field by servers. Aorigin server. This allows an origin serverSHOULD use the Vary header fieldtoinform a cacheprevent the re-use ofwhat request-headercertain header fieldswere used to select among multiple representations ofin acacheable response subject to server-driven negotiation. The setresponse, while still allowing caching ofheader fields named by the Vary field value is known asthe"selecting" request-headers. Whenrest of thecache receives a subsequent request whose Request-URI specifies oneresponse. Note: Most HTTP/1.0 caches will not recognize ormore cache entries includingobey this directive. no-store The no-store response directive indicates that aVary header field, thecache MUST NOTuse such a cache entry to construct a response to the new request unless allstore any part of either theselecting request-headers present in the newimmediate requestmatch the corresponding stored request-headers in the original request. The selecting request-headers from two requests are definedor response. This directive applies tomatch ifboth non-shared andonly if the selecting request-headersshared caches. "MUST NOT store" in this context means that thefirst request can be transformed tocache MUST NOT intentionally store theselecting request-headersinformation in non-volatile storage, and MUST make a best-effort attempt to remove thesecond request by addinginformation from volatile storage as promptly as possible after forwarding it. This directive is NOT a reliable orremoving linear white space (LWS) at places wheresufficient mechanism for ensuring privacy. In particular, malicious or compromised caches might not recognize or obey thisis allowed by the corresponding BNF, and/or combining multiple message-header fields with the same field name followingdirective, and communications networks may be vulnerable to eavesdropping. must-revalidate The must-revalidate response directive indicates that once it has become stale, therules about message headers in Section 4.2 of [Part1]. A Vary header field-value of "*" always failsresponse MUST NOT be used tomatch andsatisfy subsequent requests without successful validation onthat resource can only be properly interpreted bythe origin server.If the selecting request header fieldsThe must-revalidate directive is necessary to support reliable operation for certain protocol features. In all circumstances an HTTP/1.1 cache MUST obey thecached entry do not match the selecting request header fields of the new request, thenmust-revalidate directive; in particular, if the cacheMUST NOT use a cached entry to satisfy the request unless it first relays the new request tocannot reach the origin serverinfor any reason, it MUST generate aconditional request and the server responds with 304 (Not Modified), including an entity tag or Content-Location that indicates504 (Gateway Timeout) response. Servers SHOULD send theentity to be used. If an entity tag was assignedmust-revalidate directive if and only if failure to validate acached representation, the forwardedrequestSHOULD be conditional and includeon the entitytagscould result inan If-None-Match header field from all its cache entries for the resource. This conveys to the serverincorrect operation, such as a silently unexecuted financial transaction. proxy-revalidate The proxy-revalidate response directive has theset of entities currently held bysame meaning as thecache, somust-revalidate response directive, except thatif any oneit does not apply to non-shared caches. max-age The max-age response directive indicates that response is to be considered stale after its age is greater than the specified number ofthese entities matchesseconds. s-maxage The s-maxage response directive indicates that, in shared caches, therequested entity,maximum age specified by this directive overrides theserver can usemaximum age specified by either theETag header field in its 304 (Not Modified) response to tellmax-age directive or thecache which entry is appropriate. IfExpires header. The s-maxage directive also implies theentity-tagsemantics of thenewproxy-revalidate responsematchesdirective. no-transform The no-transform response directive indicates thatofanexisting entry,intermediate cache or proxy MUST NOT change thenewContent-Encoding, Content-Range or Content-Type responseSHOULD be used to update the header fields ofheaders, nor theexisting entry, andresponse entity-body. 3.2.3. Cache Control Extensions The Cache-Control header field can be extended through theresult MUSTuse of one or more cache-extension tokens, each with an optional value. Informational extensions (those that do not require a change in cache behavior) can bereturned toadded without changing theclient. If anysemantics of other directives. Behavioral extensions are designed to work by acting as modifiers to the existing base of cacheentries contains only partial content for the associated entity, its entity-tag SHOULD NOT be included indirectives. Both theIf-None-Match header field unlessnew directive and therequest is for a range that would be fully satisfied bystandard directive are supplied, such thatentry. If a cache receives a successful response whose Content-Location field matchesapplications thatof an existing cache entry fordo not understand thesame Request- URI, whose entity-tag differs from that ofnew directive will default to theexisting entry,behavior specified by the standard directive, andwhose Date is more recent thanthose thatofunderstand theexisting entry,new directive will recognize it as modifying theexisting entry SHOULD NOT be returned in responserequirements associated with the standard directive. In this way, extensions tofuture requests and SHOULDthe cache-control directives can bedeleted frommade without requiring changes to thecache. 9. Shared and Non-Shared Caches For reasonsbase protocol. This extension mechanism depends on an HTTP cache obeying all ofsecuritythe cache-control directives defined for its native HTTP-version, obeying certain extensions, andprivacy,ignoring all directives that itis necessary to makedoes not understand. For example, consider adistinction between "shared" and "non-shared" caches. A non-shared cache is onehypothetical new response directive called "community" thatis accessible only toacts as asingle user. Accessibility in this case SHOULD be enforced by appropriate security mechanisms. All other caches are consideredmodifier tobe "shared." Other sections of this specification place certain constraints ontheoperation of shared cachesprivate directive. We define this new directive to mean that, inorderaddition toprevent loss of privacy or failure of access controls. 10. Errors or Incomplete Response Cache Behavior Aany non-shared cache, any cache thatreceives an incomplete response (for example, with fewer bytesis shared only by members ofdata than specified in a Content-Length header) MAY store the response. However,the community named within its value may cacheMUST treat this as a partial response. Partial responses MAY be combined as described in Section 5 of [Part5];theresult might be a full response or might still be partial. A cache MUST NOT return a partial responseresponse. An origin server wishing toa client without explicitly marking it as such, usingallow the206 (Partial Content) status code. A cache MUST NOT return a partial response using a status code of 200 (OK). If a cache receives a 5xx response while attemptingUCI community torevalidateuse anentry, it MAY either forward thisotherwise private responseto the requesting client, orin their shared cache(s) could do so by including Cache-Control: private, community="UCI" A cache seeing this header field will actascorrectly even if theserver failed to respond. Incache does not understand thelatter case,community cache-extension, since itMAY return a previously received response unless the cached entry includeswill also see and understand the"must-revalidate" cache-controlprivate directive(see Section 16.2). 11. Side Effects of GETandHEAD Unless the origin server explicitly prohibits the caching of their responses,thus default to theapplication of GET and HEAD methods to any resources SHOULD NOT have side effects that would lead to erroneous behavior if these responses are taken from a cache. They MAY still have side effects, but asafe behavior. Unrecognized cache directives MUST be ignored; it isnot required to consider such side effects in its caching decisions. Caches are always expectedassumed that any cache directive likely toobservebe unrecognized by anorigin server's explicit restrictions on caching. We note one exception to this rule: since some applications have traditionally used GET and HEAD requests with URLs containing a query part to perform operationsHTTP/1.1 cache will be combined withsignificant side effects, caches MUST NOT treat responses to such URIs as fresh unlessstandard directives (or theserver provides an explicit expiration time. This specifically means that responses from HTTP/1.0 servers forresponse's default cacheability) suchURIs SHOULD NOT be taken from a cache. See Section 8.1.1 of [Part2] for related information. 12. Invalidation After Updates or Deletions The effect of certain methods performed on a resource atthat theorigin server might cause one or more existingcacheentries to become non- transparently invalid. That is, although they might continue to be "fresh," they do not accurately reflect whatbehavior will remain minimally correct even if theorigin server would return for a new request on that resource. There is no way for HTTP to guarantee that all suchcacheentries are marked invalid. For example, the request that causeddoes not understand thechange atextension(s). 3.3. Expires The entity-header field "Expires" gives theorigin server might not have gone throughdate/time after which theproxy where a cache entryresponse isstored. However, several rules help reduce the likelihoodconsidered stale. See Section 2.3 for further discussion oferroneous behavior. In this section,thephrase "invalidatefreshness model. The presence of anentity" meansExpires field does not imply that thecache will either remove all instances of that entity from its storage, ororiginal resource willmark these as "invalid"change or cease to exist at, before, or after that time. The field-value is an absolute date and time as defined by HTTP-date inneedSection 3.2.1 ofa mandatory revalidation before they can[Part1]; it MUST bereturnedsent inresponse torfc1123-date format. Expires = "Expires" ":" OWS Expires-v Expires-v = HTTP-date For example Expires: Thu, 01 Dec 1994 16:00:00 GMT Note: if asubsequent request. Some HTTP methods MUST causeresponse includes acache to invalidate an entity. This is either the entity referred to byCache-Control field with theRequest-URI, or bymax- age directive (see Section 3.2.2), that directive overrides theLocation or Content-Location headers (if present). These methods are: o PUT o DELETE o POST An invalidation based onExpires field. Likewise, theURIs-maxage directive overrides Expires ina Location or Content-Location header MUSTshared caches. HTTP/1.1 servers SHOULD NOTbe performed ifsend Expires dates more than one year in thehost part of that URI differs fromfuture. HTTP/1.1 clients and caches MUST treat other invalid date formats, especially including thehost partvalue "0", as in theRequest-URI. This helps prevent denial of service attacks. A cachepast (i.e., "already expired"). 3.4. Pragma The general-header field "Pragma" is used to include implementation- specific directives thatpasses through requests for methods it does not understand SHOULD invalidate any entities referredmight apply tobyany recipient along theRequest- URI. 13. Write-Through Mandatoryrequest/response chain. Allmethodspragma directives specify optional behavior from the viewpoint of the protocol; however, some systems MAY require thatmightbehavior beexpected to cause modifications toconsistent with theorigin server's resources MUST be written through todirectives. Pragma = "Pragma" ":" OWS Pragma-v Pragma-v = 1#pragma-directive pragma-directive = "no-cache" / extension-pragma extension-pragma = token [ "=" ( token / quoted-string ) ] When theorigin server. This currently includes all methods except for GET and HEAD. A cache MUST NOT reply to suchno-cache directive is present in a requestfrom a client before having transmittedmessage, an application SHOULD forward the requesttotoward theinbound server, and having receivedorigin server even if it has acorresponding response from the inbound server.cached copy of what is being requested. Thisdoes not preventpragma directive has the same semantics as the no-cache response directive (see Section 3.2.2) and is defined here for backward compatibility with HTTP/1.0. Clients SHOULD include both header fields when aproxyno- cachefrom sendingrequest is sent to a100 (Continue) response before the inboundserverhasnot known to be HTTP/1.1 compliant. HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client had sentits final reply. The alternative (known"Cache-Control: no-cache". Note: because the meaning of "Pragma: no-cache" as"write-back" or "copy-back" caching)a response- header field is notallowedactually specified, it does not provide a reliable replacement for "Cache-Control: no-cache" inHTTP/1.1, due toa response. This mechanism is deprecated; no new Pragma directives will be defined in HTTP. 3.5. Vary The "Vary" response-header field's value indicates thedifficultyset ofproviding consistent updates andrequest-header fields that determines, while theproblems arising from server, cache, or network failure prior to write-back. 14. Cache Replacement If a new cacheable (see Sections 16.2.2, 4.5, 4.6 and 10)response isreceived fromfresh, whether aresource while any existing responses for the same resource are cached, thecacheSHOULDis permitted to use thenewresponse to reply to a subsequent request without validation; see Section 2.6. In uncacheable or stale responses, thecurrent request. It MAY insert it into cache storage and MAY, if it meets all other requirements, use it to respond to any future requests that would previously have causedVary field value advises theold responseuser agent about the criteria that were used tobe returned. If it insertsselect thenew response into cache storagerepresentation. Vary = "Vary" ":" OWS Vary-v Vary-v = "*" / 1#field-name The set of header fields named by therules in Section 7.3 apply. Note:Vary field value is known as the selecting request-headers. Servers SHOULD include anewVary header field with any cacheable response thathas an older Date header value than existing cached responsesisnot cacheable. 15. History Lists User agents often have history mechanisms, such as "Back" buttons and history lists, which can be usedsubject toredisplay an entity retrieved earlier inserver-driven negotiation. Doing so allows asession. History mechanisms and caches are different. In particular history mechanisms SHOULD NOT trycache toshow a semantically transparent view ofproperly interpret future requests on that resource and informs thecurrent stateuser agent about the presence ofanegotiation on that resource.Rather,A server MAY include ahistory mechanismVary header field with a non- cacheable response that ismeantsubject toshow exactly whatserver-driven negotiation, since this might provide the usersawagent with useful information about the dimensions over which the response varies at the timewhenof theresource was retrieved. By default, an expiration time doesresponse. A Vary field value of "*" signals that unspecified parameters notapplylimited tohistory mechanisms. Iftheentity is still in storage, a history mechanism SHOULD display it even ifrequest-headers (e.g., theentity has expired, unlessnetwork address of theuser has specifically configuredclient), play a role in theagent to refresh expired history documents. Thisselection of the response representation; therefore, a cache cannot determine whether this response isnot toappropriate. The "*" value MUST NOT beconstrued to prohibit the history mechanism from telling the user thatgenerated by aview mightproxy server; it may only bestale. Note: if history list mechanisms unnecessarily prevent users from viewing stale resources, this will tendgenerated by an origin server. The field-names given are not limited toforce service authorsthe set of standard request- header fields defined by this specification. Field names are case- insensitive. 3.6. Warning The general-header field "Warning" is used toavoid using HTTP expiration controls and cache controls when they would otherwise like to. Service authors may consider it important that users not be presented with error messagescarry additional information about the status orwarning messages when they use navigation controls (such as BACK) to view previously fetched resources. Even though sometimes such resources oughttransformation of a message that might not becached, or ought to expire quickly, user interface considerations may force service authors to resortreflected in the message. This information is typically used toother means of preventingwarn about possible incorrectness introduced by caching(e.g. "once-only" URLs) in order notoperations or transformations applied tosuffertheeffectsentity body ofimproperly functioning history mechanisms. 16. Header Field Definitions This section definesthesyntax and semantics of HTTP/1.1 header fields related to caching. For entity-header fields,message. Warnings can be used for other purposes, bothsendercache-related andrecipient refer to either the client or the server, depending on who sends and who receives the entity. 16.1. Ageotherwise. Theresponse-header field "Age" conveys the sender's estimate of the amountuse oftime since the response (or its revalidation) was generated at the origin server. A cached response is "fresh" if its age does not exceed its freshness lifetime. Age values are calculated as specifieda warning, rather than an error status code, distinguish these responses from true failures. Warning headers can inSection 4.3. Agegeneral be applied to any message, however some warn-codes are specific to caches and can only be applied to response messages. Warning ="Age""Warning" ":" OWSAge-v Age-vWarning-v Warning-v =delta-seconds Age values are non-negative decimal integers, representing time1#warning-value warning-value = warn-code SP warn-agent SP warn-text [SP warn-date] warn-code = 3DIGIT warn-agent = ( uri-host [ ":" port ] ) / pseudonym ; the name or pseudonym of the server adding ; the Warning header, for use inseconds. delta-secondsdebugging warn-text =1*DIGIT If a cache receivesquoted-string warn-date = DQUOTE HTTP-date DQUOTE Multiple warnings can be attached to avalue larger thanresponse (either by thelargest positive integer it can represent,origin server orif any of its age calculations overflows, it MUST transmit an Age headerby a cache), including multiple warnings with the same code number. For example, avalue of 2147483648 (2^31). An HTTP/1.1serverthat includes a cache MUST include an Age header fieldmight provide the same warning with texts inevery response generated from its own cache. Cachesboth English and Basque. When this occurs, the user agent SHOULDuse an arithmetic typeinform the user ofat least 31 bitsas many ofrange. 16.2. Cache-Control The general-header field "Cache-Control"them as possible, in the order that they appear in the response. If it isusednot possible tospecify directives that MUST be obeyed byinform the user of allcaching mechanisms alongof therequest/response chain. The directives specify behavior intended to prevent caches from adversely interfering withwarnings, therequest or response. These directives typically overrideuser agent SHOULD follow these heuristics: o Warnings that appear early in thedefault caching algorithms. Cache directives are unidirectionalresponse take priority over those appearing later inthatthepresence of a directiveresponse. o Warnings ina request does not implythe user's preferred character set take priority over warnings in other character sets but with identical warn-codes and warn-agents. Systems that generate multiple Warning headers SHOULD order them with this user agent behavior in mind. New Warning headers SHOULD be added after any existing Warning headers. Warnings are assigned three digit warn-codes. The first digit indicates whether thesame directiveWarning is required to begiven in the response. Notedeleted from a stored response after validation: o 1xx Warnings thatHTTP/1.0 caches might not implement Cache-Controldescribe the freshness or validation status of the response, andmight only implement Pragma: no-cache (see Section 16.4). Cache directivesso MUST bepassed throughdeleted bya proxy or gateway application, regardless of their significance to that application, since the directives mightcaches after validation. They MUST NOT beapplicable to all recipients along the request/response chain. It is not possible to specifygenerated by acache- directive forcache except when validating aspecific cache. Cache-Control = "Cache-Control" ":" OWS Cache-Control-v Cache-Control-v = 1#cache-directive cache-directive = cache-request-directive / cache-response-directive cache-request-directive = "no-cache" ; Section 16.2.1 / "no-store" ; Section 16.2.2 / "max-age" "=" delta-seconds ; Section 16.2.3, 16.2.4 / "max-stale" [ "=" delta-seconds ] ; Section 16.2.3 / "min-fresh" "=" delta-seconds ; Section 16.2.3 / "no-transform" ; Section 16.2.5 / "only-if-cached" ; Section 16.2.4 / cache-extension ; Section 16.2.6 cache-response-directive = "public" ; Section 16.2.1 / "private" [ "=" DQUOTE 1#field-name DQUOTE ] ; Section 16.2.1 / "no-cache" [ "=" DQUOTE 1#field-name DQUOTE ] ; Section 16.2.1 / "no-store" ; Section 16.2.2 / "no-transform" ; Section 16.2.5 / "must-revalidate" ; Section 16.2.4 / "proxy-revalidate" ; Section 16.2.4 / "max-age" "=" delta-seconds ; Section 16.2.3 / "s-maxage" "=" delta-seconds ; Section 16.2.3 / cache-extension ; Section 16.2.6 cache-extension = token [ "=" ( token / quoted-string ) ] When a directive appears without any 1#field-name parameter, the directive applies tocached entry, and MUST NOT be generated by clients. o 2xx Warnings that describe some aspect of theentire requestentity body orresponse. When suchentity headers that is not rectified by adirective appears withvalidation (for example, a1#field-name parameter, it applies only tolossy compression of thenamed field or fields,entity bodies) andnotMUST NOT be deleted by caches after validation, unless a full response is returned, in which case they MUST be. The warn-text SHOULD be in a natural language and character set that is most likely to be intelligible to therest ofhuman user receiving therequest orresponse. Thismechanism supports extensibility; implementations of future versions of HTTP might apply these directives to header fields not defined in HTTP/1.1. The cache-control directivesdecision can bebroken down into these general categories: o Restrictionsbased onwhat are cacheable; these may only be imposed byany available knowledge, such as theorigin server. o Restrictions on what may be stored by a cache; these may be imposed by eitherlocation of theorigin servercache or user, theuser agent. o Modifications ofAccept-Language field in a request, thebasic expiration mechanism; these mayContent-Language field in a response, etc. The default language is English and the default character set is ISO- 8859-1 ([ISO-8859-1]). If a character set other than ISO-8859-1 is used, it MUST beimposed by eitherencoded in theorigin server orwarn-text using theuser agent. o Controls over cache revalidation and reload; these may only be imposed bymethod described in [RFC2047]. If an implementation sends auser agent. o Control over transformation of entities. o Extensionsmessage with one or more Warning headers tothe caching system. 16.2.1. What is Cacheable By default,aresponsereceiver whose version iscacheable ifHTTP/1.0 or lower, then therequirements ofsender MUST include in each warning-value a warn-date that matches therequest method, requestDate headerfields, andin theresponse status indicate that it is cacheable. Section 6 summarizes these defaults for cacheability. The following Cache-Control response directives allowmessage. If anorigin server to override the default cacheability ofimplementation receives aresponse: public Indicatesmessage with a warning-value that includes a warn-date, and that warn-date is different from theresponse MAY be cached by any cache, even if it would normallyDate value in the response, then that warning-value MUST benon-cacheabledeleted from the message before storing, forwarding, orcacheable only within a non- shared cache. (See also Authorization, Section 4.1using it. (preventing the consequences of[Part7], for additional details.) private Indicates thatnaive caching of Warning header fields.) If allor partof theresponse message is intendedwarning-values are deleted fora single user andthis reason, the Warning header MUSTNOTbecacheddeleted as well. The following warn-codes are defined by this specification, each with ashared cache. This allows an origin server to state that the specified parts of the response are intended for only one userrecommended warn-text in English, andare notavalid response for requests by other users. A private (non-shared) cache MAY cache the response. Note: This usagedescription of its meaning. 110 Response is stale SHOULD be included whenever theword private only controls where thereturned responsemayis stale. 111 Revalidation failed SHOULD becached, and cannot ensure the privacy of the message content. no-cache If the no-cache directive does not specify a field-name, thenincluded if a cacheMUST NOT use the response to satisfyreturns asubsequent request without successful revalidation with the origin server. This allows an origin server to prevent caching even by caches that have been configured to returnstaleresponsesresponse because an attempt toclient requests. If the no-cache directive does specify one or more field-names, then a cache MAY usevalidate the response failed, due tosatisfy a subsequent request, subjectan inability toany other restrictions on caching. However,reach thespecified field-name(s) MUST NOTserver. 112 Disconnected operation SHOULD besent in the response to a subsequent request without successful revalidation withincluded if theorigin server. This allows an origin server to preventcache is intentionally disconnected from there-use of certain header fields in a response, while still allowing cachingrest of therestnetwork for a period of time. 113 Heuristic expiration SHOULD be included if theresponse. Note: Most HTTP/1.0 caches will not recognize or obey this directive. 16.2.2. What May be Stored by Caches no-store The purpose ofcache heuristically chose a freshness lifetime greater than 24 hours and theno-store directiveresponse's age isto prevent the inadvertent release or retention of sensitive information (for example, on backup tapes).greater than 24 hours. 199 Miscellaneous warning Theno-store directive applieswarning text can include arbitrary information tothe entire message, and MAYbesent either inpresented to aresponsehuman user, orin a request. If sent in a request, a cache MUST NOT store any part of eitherlogged. A system receiving thisrequest or any response to it. If sent in a response, a cachewarning MUST NOTstoretake anypart of either this response orautomated action, besides presenting therequest that elicited it. This directive applieswarning toboth non- shared and shared caches. "MUST NOT store" in this context means thatthecacheuser. 214 Transformation applied MUSTNOT intentionally storebe added by an intermediate cache or proxy if it applies any transformation changing theinformationcontent-coding (as specified innon-volatile storage, and MUST make a best-effort attempt to removetheinformation from volatile storage as promptly as possible after forwarding it. Even when this directive is associated with a response, users might explicitly store such a response outside ofContent-Encoding header) or media-type (as specified in thecaching system (e.g., with a "Save As" dialog). History buffers MAY store such responses as part of their normal operation. The purposeContent-Type header) ofthis directive is to meetthestated requirements of certain users and service authors who are concerned about accidental releases of information via unanticipated accesses to cache data structures. Whileresponse, or theuseentity-body of the response, unless thisdirective might improve privacy in some cases, we caution that it is NOTWarning code already appears inany waythe response. 299 Miscellaneous persistent warning The warning text can include arbitrary information to be presented to areliable or sufficient mechanism for ensuring privacy. In particular, malicious or compromised caches might not recognizehuman user, orobeylogged. A system receiving thisdirective,warning MUST NOT take any automated action. 4. History Lists User agents often have history mechanisms, such as "Back" buttons andcommunications networks mighthistory lists, that can bevulnerableused toeavesdropping. 16.2.3. Modifications of the Basic Expiration Mechanism The expiration time ofredisplay an entityMAY be specified by the origin server using the Expires header (see Section 16.3). Alternatively, it MAY be specified using the max-age directiveretrieved earlier in aresponse. When the max-age cache-control directive is present insession. History mechanisms and caches are different. In particular history mechanisms SHOULD NOT try to show acached response,correct view of theresponse is stale if itscurrentage is greater than the age value given (in seconds) at the timestate of anew request for thatresource.The max-age directive onRather, aresponse implies that the response is cacheable (i.e., "public") unless some other, more restrictive cache directivehistory mechanism isalso present. If a response includes both an Expires header and a max-age directive,meant to show exactly what themax-age directive overridesuser saw at theExpires header, even iftime when theExpires header is more restrictive. This rule allowsresource was retrieved. By default, anorigin server to provide, for a given response, a longerexpiration time does not apply toan HTTP/1.1 (or later) cache than to an HTTP/1.0 cache. This might be useful if certain HTTP/1.0 caches improperly calculate ages or expiration times, perhaps due to desynchronized clocks. Many HTTP/1.0 cache implementations will treat an Expires value that is less than or equal to the response Date value as being equivalent to the Cache-Control response directive "no-cache".history mechanisms. Ifan HTTP/1.1 cache receives such a response, andtheresponse does not includeentity is still in storage, aCache-Control header field, ithistory mechanism SHOULDconsiderdisplay it even if theresponseentity has expired, unless the user has specifically configured the agent to refresh expired history documents. This is not to benon-cacheable in orderconstrued toretain compatibility with HTTP/1.0 servers. Note: An origin serverprohibit the history mechanism from telling the user that a view mightwishbe stale. Note: if history list mechanisms unnecessarily prevent users from viewing stale resources, this will tend touse a relatively newforce service authors to avoid using HTTP expiration controls and cachecontrol feature, such as the "private" directive, on a network including older cachescontrols when they would otherwise like to. Service authors may consider it important thatdousers notunderstand that feature. The origin server will need to combine the new featurebe presented withan Expires field whose value is less thanerror messages orequalwarning messages when they use navigation controls (such as BACK) tothe Date value. This will prevent older caches from improperly caching the response. s-maxage If a response includes an s-maxage directive, then for a shared cache (butview previously fetched resources. Even though sometimes such resources ought notfor a private cache), the maximum age specified by this directive overrides the maximum age specified by either the max-age directivebe cached, or ought to expire quickly, user interface considerations may force service authors to resort to other means of preventing caching (e.g. "once-only" URLs) in order not to suffer theExpires header. The s-maxage directive also implies the semanticseffects of improperly functioning history mechanisms. 5. IANA Considerations 5.1. Message Header Registration The Message Header Registry located at <http://www.iana.org/ assignments/message-headers/message-header-index.html> should be updated with theproxy-revalidate directivepermanent registrations below (see [RFC3864]): +-------------------+----------+----------+-------------+ | Header Field Name | Protocol | Status | Reference | +-------------------+----------+----------+-------------+ | Age | http | standard | Section16.2.4), i.e., that3.1 | | Cache-Control | http | standard | Section 3.2 | | Expires | http | standard | Section 3.3 | | Pragma | http | standard | Section 3.4 | | Vary | http | standard | Section 3.5 | | Warning | http | standard | Section 3.6 | +-------------------+----------+----------+-------------+ The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force". 6. Security Considerations Caches expose additional potential vulnerabilities, since theshared cache must not usecontents of theentrycache represent an attractive target for malicious exploitation. Because cache contents persist afterit becomes stale to respond to a subsequentan HTTP requestwithout first revalidating it with the origin server. The s-maxage directiveisalways ignored by a private cache. Note that most older caches, not compliant with this specification, do not implement any cache-control directives. An origin server wishing to use a cache-control directive that restricts, but does not prevent, caching bycomplete, anHTTP/1.1-compliant cache MAY exploitattack on therequirementcache can reveal information long after a user believes that themax-age directive overrides the Expires header, and the fact that pre-HTTP/1.1-compliant caches do not observeinformation has been removed from themax-age directive. Other directives allow a user agent to modify the basic expiration mechanism. These directives MAY be specified on a request: max-age Indicates that the client is willing to accept a response whose age is no greater than the specified time in seconds. Unless max- stale directive is also included, the client is not willing to accept a stale response. min-fresh Indicates that the client is willing to accept a response whose freshness lifetime is no less than its current age plus the specified time in seconds. That is, the client wants a response that will still be fresh for at least the specified number of seconds. max-stale Indicates that the client is willing to accept a response that has exceeded its expiration time. If max-stale is assigned a value, then the client is willing to accept a response that has exceeded its expiration time by no more than the specified number of seconds. If no value is assigned to max-stale, then the client is willing to accept a stale response of any age. If anetwork. Therefore, cachereturns a stale response, either becausecontents should be protected as sensitive information. 7. Acknowledgments Much ofa max-stale directive on a request, or because the cache is configured to overridetheexpiration timecontent and presentation ofa response, the cache MUST attach a Warning header tothestale response, using Warning 110 (Responsecaching design isstale). A cache MAY be configureddue toreturn stale responses without validation, but only if this does not conflict with any "MUST"-level requirements concerning cache validation (e.g., a "must-revalidate" cache-control directive). If both the new requestsuggestions andthe cached entry include "max-age" directives, then the lesser of the two values is used for determining the freshness of the cached entry for that request. 16.2.4. Cache Revalidation and Reload Controls Sometimes a user agent might want or need to insist that a cache revalidate its cache entry with the origin server (and not just with the next cache along the path to the origin server), or to reload its cache entrycomments fromthe origin server. End-to-end revalidation might be necessary if either the cache or the origin server has overestimated the expiration time of the cached response. End-to-end reload may be necessary if the cache entry has become corruptedindividuals including: Shel Kaphan, Paul Leach, Koen Holtman, David Morris, and Larry Masinter. 8. References 8.1. Normative References [ISO-8859-1] International Organization forsome reason. End-to-end revalidation may be requested either when the client does not have its own local cached copy, in which case we call it "unspecified end-to-end revalidation", or when the client does have a local cached copy,Standardization, "Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1", ISO/ IEC 8859-1:1998, 1998. [Part1] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 1: URIs, Connections, and Message Parsing", draft-ietf-httpbis-p1-messaging-06 (work inwhich case we call it "specific end-to-end revalidation." The client can specify these three kinds of action using Cache- Control request directives: End-to-end reload The request includes a "no-cache" cache-control directive or, for compatibility with HTTP/1.0 clients, "Pragma: no-cache". Field names MUST NOT be included with the no-cache directiveprogress), March 2009. [Part2] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 2: Message Semantics", draft-ietf-httpbis-p2-semantics-06 (work ina request. The server MUST NOT use a cached copy when responding to such a request. Specific end-to-end revalidation The request includes a "max-age=0" cache-control directive, which forces each cache along the path to the origin server to revalidate its own entry, if any, with the next cache or server. The initial request includes a cache-validating conditional with the client's current validator. Unspecified end-to-end revalidation The request includes "max-age=0" cache-control directive, which forces each cache along the path to the origin server to revalidate its own entry, if any, with the next cache or server. The initial request does not include a cache-validating conditional; the first cache along the path (if any) that holds a cache entry for this resource includes a cache-validating conditional with its current validator. max-age When an intermediate cache is forced, by means of a max-age=0 directive, to revalidate its own cache entry,progress), March 2009. [Part3] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., andthe client has supplied its own validator in the request, the supplied validator might differ from the validator currently stored with the cache entry. In this case, the cache MAY use either validator in making its own request without affecting semantic transparency. However, the choice of validator might affect performance. The best approach is for the intermediate cache to use its own validator when making its request. If the server replies with 304 (Not Modified), then the cache can return its now validated copy to the client with a 200 (OK) response. If the server replies with a new entityJ. Reschke, Ed., "HTTP/1.1, part 3: Message Payload andcache validator, however, the intermediate cache can compare the returned validator with the one providedContent Negotiation", draft-ietf-httpbis-p3-payload-06 (work inthe client's request, using the strong comparison function. If the client's validator is equal to the origin server's, then the intermediate cache simply returns 304 (Not Modified). Otherwise, it returns the new entity with a 200 (OK) response. If a request includes the no-cache directive, it SHOULD NOT include min-fresh, max-stale, or max-age. only-if-cached In some cases, such as times of extremely poor network connectivity, a client may want a cache to return only those responses that it currently has stored,progress), March 2009. [Part4] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., andnot to reload or revalidate with the origin server. To do this, the client may include the only-if-cached directiveJ. Reschke, Ed., "HTTP/1.1, part 4: Conditional Requests", draft-ietf-httpbis-p4-conditional-06 (work ina request. If it receives this directive, a cache SHOULD either respond using a cached entry that is consistent with the other constraints of the request, or respond with a 504 (Gateway Timeout) status. However, if a group of caches is being operated as a unified system with good internal connectivity, such a request MAY be forwarded within that group of caches. must-revalidate Because a cache MAY be configured to ignore a server's specified expiration time,progress), March 2009. [Part5] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., andbecause a client request MAY include a max- stale directive (which has a similar effect), the protocol also includes a mechanism for the origin server to require revalidation of a cache entry on any subsequent use. When the must-revalidate directive is presentJ. Reschke, Ed., "HTTP/1.1, part 5: Range Requests and Partial Responses", draft-ietf-httpbis-p5-range-06 (work ina response received by a cache, that cache MUST NOTprogress), March 2009. [Part7] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 7: Authentication", draft-ietf-httpbis-p7-auth-06 (work in progress), March 2009. [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text", RFC 2047, November 1996. [RFC2119] Bradner, S., "Key words for usethe entry after it becomes stale to respondin RFCs toa subsequent request without first revalidating itIndicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008. 8.2. Informative References [RFC1305] Mills, D., "Network Time Protocol (Version 3) Specification, Implementation", RFC 1305, March 1992. [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration Procedures for Message Header Fields", BCP 90, RFC 3864, September 2004. Appendix A. Compatibility with Previous Versions A.1. Changes from RFC 2068 A case was missed in theorigin server. (I.e., the cache MUST do an end-to-end revalidation every time, if, based solely on the origin server's Expires or max-age value, the cached response is stale.) The must-revalidate directive is necessaryCache-Control model of HTTP/1.1; s-maxage was introduced tosupport reliable operation for certain protocol features. Inadd this missing case. (Sections 2.1, 3.2). Transfer-coding and message lengths allcircumstances an HTTP/1.1 cache MUST obey the must-revalidate directive;interact inparticular, if the cache cannot reach the origin serverways that required fixing exactly when chunked encoding is used (to allow forany reason, it MUST generate a 504 (Gateway Timeout) response. Servers SHOULD send the must-revalidate directive if and only if failure to revalidate a request on the entity could result in incorrect operation, such as a silently unexecuted financial transaction. Recipients MUST NOT take any automated actiontransfer encoding thatviolates this directive, and MUST NOT automatically provide an unvalidated copy of the entity if revalidation fails. Although this ismay notrecommended, user agents operating under severe connectivity constraints MAY violate this directive but, if so, MUST explicitly warn the user that an unvalidated response has been provided. The warning MUSTbeprovided on each unvalidated access, and SHOULD require explicit user confirmation. proxy-revalidate The proxy-revalidate directive has the same meaning as the must- revalidate directive, except thatself delimiting); itdoes not applywas important tonon-shared user agent caches. It can bestraighten out exactly how message lengths are computed. (see also [Part1], [Part3] and [Part5]) [[anchor18: This usedon a responsetoan authenticated requestrefer topermittheuser's cache to storetext about non-modifiable headers, and will have to be updated laterreturn the response without needingon. --jre]] Proxies should be able torevalidate it (since it has already been authenticated once by that user), while still requiring proxies that service many usersadd Content-Length when appropriate. [[anchor19: This used torevalidate each time (in orderrefer tomake sure that each user has been authenticated). Note that such authenticated responses also needthepublic cache control directive in order to allow them to be cached at all. 16.2.5. No-Transform Directive no-transform Implementors of intermediate caches (proxies)text about non-modifiable headers, and will havefound it usefultoconvertbe updated later on. --jre]] Range request responses would become very verbose if all meta-data were always returned; by allowing themedia type of certain entity bodies. A non- transparent proxy might, for example, convert between image formats in order to save cache space orserver toreduce the amount of traffic on a slow link. Serious operational problems occur, however, when these transformations are applied to entity bodies intended for certain kinds of applications. For example, applications for medical imaging, scientific data analysis and those using end-to-end authentication, all depend on receiving an entity body that is bit for bit identical to the original entity-body. Therefore, if a message includes the no-transform directive, an intermediate cache or proxy MUST NOT change thoseonly send needed headersthat are listedinSection 7.2 as being subject to the no-transform directive. This implies that the cache or proxy MUST NOT change any aspect of the entity-body that is specified by these headers, including the value of the entity-body itself. 16.2.6. Cache Control Extensions The Cache-Control header fielda 206 response, this problem can beextended through the use of one or more cache-extension tokens, each with an optional assigned value. Informational extensions (those which doavoided. (Section 2.7) The Cache-Control: max-age directive was notrequire a change in cache behavior) MAYproperly defined for responses. (Section 3.2.2) Warnings could beadded without changing the semantics of other directives. Behavioral extensions are designed to work by acting as modifiers to the existing base of cache directives. Both the new directive and the standard directive are supplied, such that applications which docached incorrectly, or notunderstand the new directive will default to the behavior specified by the standard directive,updated appropriately. (Section 2.3, 2.7, 3.2, andthose that understand the new directive will recognize it as modifying the requirements associated with the standard directive. In this way, extensions3.6) Warning also needed tothe cache-control directives canbemade without requiring changes to the base protocol. This extension mechanism depends on an HTTP cache obeying all of the cache-control directives defined for its native HTTP-version, obeying certain extensions, and ignoring all directives that it does not understand. For example, considerahypothetical new response directive called community which actsgeneral header, asa modifier to the private directive. We define this new directive to mean that, in addition to any non-shared cache, any cache which is shared only by members of the community named within its valuePUT or other methods maycache the response. An origin server wishing to allow the UCI community to use an otherwise private response in their shared cache(s) could do so by including Cache-Control: private, community="UCI" A cache seeing this header field will act correctly even if the cache does not understand the community cache-extension, since it will also see and understand the private directive and thus default to the safe behavior. Unrecognized cache-directives MUST be ignored;have need for itis assumed that anyin requests. A.2. Changes from RFC 2616 Clarify denial of service attack avoidance requirement. (Section 2.5) Appendix B. Collected ABNF Age = "Age:" OWS Age-v Age-v = delta-seconds Cache-Control = "Cache-Control:" OWS Cache-Control-v Cache-Control-v = *( "," OWS ) cache-directivelikely to be unrecognized by an HTTP/1.1 cache will be combined with standard directives (or the response's default cacheability) such that the cache behavior will remain minimally correct even if the cache does not understand the extension(s). 16.3. Expires The Expires entity-header field gives the date/time after which the response is considered stale. A stale cache entry may not normally be returned by a cache (either a proxy cache or a user agent cache) unless it is first validated with the origin server (or with an intermediate cache that has a fresh copy of the entity). See Section 4 for further discussion of the expiration model. The presence of an Expires field does not imply that the original resource will change or cease to exist at, before, or after that time. The format is an absolute date and time as defined by HTTP-date in Section 3.3.1 of [Part1]; it MUST be sent in rfc1123-date format.*( OWS "," [ OWS cache-directive ] ) Expires ="Expires" ":""Expires:" OWS Expires-v Expires-v = HTTP-dateAn example of its use is Expires: Thu, 01 Dec 1994 16:00:00 GMT Note: if a response includes a Cache-Control field with the max- age directive (see Section 16.2.3), that directive overrides the Expires field. HTTP/1.1 clients and caches MUST treat other invalid date formats, especially including the value "0", as in the past (i.e., "already expired"). To mark a response as "already expired," an origin server sends an Expires date that is equal to the Date header value. (See the rules for expiration calculationsHTTP-date = <HTTP-date, defined in [Part1], Section4.4.) To mark a response as "never expires," an origin server sends an Expires date approximately one year from the time the response is sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one year in the future. The presence of an Expires header field with a date value of some time3.2.1> OWS = <OWS, defined inthe future on a response that otherwise would by default be non-cacheable indicates that the response is cacheable, unless indicated otherwise by a Cache-Control header field (Section 16.2). 16.4. Pragma The general-header field "Pragma" is used to include implementation- specific directives that might apply to any recipient along the request/response chain. All pragma directives specify optional behavior from the viewpoint of the protocol; however, some systems MAY require that behavior be consistent with the directives.[Part1], Section 1.2.2> Pragma ="Pragma" ":""Pragma:" OWS Pragma-v Pragma-v =1#pragma-directive*( "," OWS ) pragma-directive *( OWS "," [ OWS pragma-directive ] ) Vary = "Vary:" OWS Vary-v Vary-v = "*" / ( *( "," OWS ) field-name *( OWS "," [ OWS field-name ] ) ) Warning = "Warning:" OWS Warning-v Warning-v = *( "," OWS ) warning-value *( OWS "," [ OWS warning-value ] ) cache-directive = cache-request-directive / cache-response-directive cache-extension = token [ "=" ( token / quoted-string ) ] cache-request-directive = "no-cache" /extension-pragma"no-store" / ( "max-age=" delta-seconds ) / ( "max-stale" [ "=" delta-seconds ] ) / ( "min-fresh=" delta-seconds ) / "no-transform" / "only-if-cached" / cache-extension cache-response-directive = "public" / ( "private" [ "=" DQUOTE *( "," OWS ) field-name *( OWS "," [ OWS field-name ] ) DQUOTE ] ) / ( "no-cache" [ "=" DQUOTE *( "," OWS ) field-name *( OWS "," [ OWS field-name ] ) DQUOTE ] ) / "no-store" / "no-transform" / "must-revalidate" / "proxy-revalidate" / ( "max-age=" delta-seconds ) / ( "s-maxage=" delta-seconds ) / cache-extension delta-seconds = 1*DIGIT extension-pragma = token [ "=" ( token / quoted-string ) ]When the no-cache directive is present in a request message, an application SHOULD forward the request toward the origin server even if it has a cached copy of what is being requested. This pragma directive has the same semantics as the no-cache cache-directive (see Section 16.2) and isfield-name = <field-name, definedhere for backward compatibility with HTTP/1.0. Clients SHOULD include both header fields when a no-cache request is sent to a server not known to be HTTP/1.1 compliant. Pragma directives MUST be passed through by a proxy or gateway application, regardless of their significance to that application, since the directives might be applicable to all recipients along the request/response chain. It is not possible to specify a pragma for a specific recipient; however, any pragma directive not relevant to a recipient SHOULD be ignored by that recipient. HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client had sent "Cache-Control: no-cache". No new Pragma directives will be defined in HTTP. Note: because the meaning of "Pragma: no-cache" as a response- header field is not actually specified, it does not provide a reliable replacement for "Cache-Control: no-cache" in a response. 16.5. Vary The "Vary" response-header field's value indicates the set of request-header fields that fully determines, while the response is fresh, whether a cache is permitted to use the response to reply to a subsequent request without revalidation. For uncacheable or stale responses, the Vary field value advises the user agent about the criteria that were used to select the representation. A Vary field value of "*" implies that a cache cannot determine from the request headers of a subsequent request whether this response is the appropriate representation. See Section 8 for use of the Vary header field by caches. Vary = "Vary" ":" OWS Vary-v Vary-v = "*" / 1#field-name An HTTP/1.1 server SHOULD include a Vary header field with any cacheable response that is subject to server-driven negotiation. Doing so allows a cache to properly interpret future requests on that resource and informs the user agent about the presence of negotiation on that resource. A server MAY include a Vary header field with a non-cacheable response that is subject to server-driven negotiation, since this might provide the user agent with useful information about the dimensions over which the response varies at the time of the response. A Vary field value consisting of a list of field-names signals that the representation selected for the response is based on a selection algorithm which considers ONLY the listed request-header field values in selecting the most appropriate representation. A cache MAY assume that the same selection will be made for future requests with the same values for the listed field names, for the duration of time for which the response is fresh. The field-names given are not limited to the set of standard request- header fields defined by this specification. Field names are case- insensitive. A Vary field value of "*" signals that unspecified parameters not limited to the request-headers (e.g., the network address of the client), play a role in the selection of the response representation. The "*" value MUST NOT be generated by a proxy server; it may only be generated by an origin server. 16.6. Warning The general-header field "Warning" is used to carry additional information about the status or transformation of a message which might not be reflected in the message. This information is typically used to warn about a possible lack of semantic transparency from caching operations or transformations applied to the entity body of the message. Warning headers are sent with responses using: Warning = "Warning" ":" OWS Warning-v Warning-v = 1#warning-value warning-value = warn-code SP warn-agent SP warn-text [SP warn-date] warn-code = 3DIGIT warn-agent = ( uri-host [ ":" port ] ) / pseudonym ; the name or pseudonym of the server adding ; the Warning header, for use in debugging warn-text = quoted-string warn-date = DQUOTE HTTP-date DQUOTE A response MAY carry more than one Warning header. The warn-text SHOULD be in a natural language and character set that is most likely to be intelligible to the human user receiving the response. This decision MAY be based on any available knowledge, such as the location of the cache or user, the Accept-Language field in a request, the Content-Language field in a response, etc. The default language is English and the default character set is ISO- 8859-1 ([ISO-8859-1]). If a character set other than ISO-8859-1 is used, it MUST be encoded in the warn-text using the method described in [RFC2047]. Warning headers can in general be applied to any message, however some specific warn-codes are specific to caches and can only be applied to response messages. New Warning headers SHOULD be added after any existing Warning headers. A cache MUST NOT delete any Warning header that it received with a message. However, if a cache successfully validates a cache entry, it SHOULD remove any Warning headers previously attached to that entry except as specified for specific Warning codes. It MUST then add any Warning headers received in the validating response. In other words, Warning headers are those that would be attached to the most recent relevant response. When multiple Warning headers are attached to a response, the user agent ought to inform the user of as many of them as possible, in the order that they appear in the response. If it is not possible to inform the user of all of the warnings, the user agent SHOULD follow these heuristics: o Warnings that appear early in the response take priority over those appearing later in the response. o Warnings in the user's preferred character set take priority over warnings in other character sets but with identical warn-codes and warn-agents. Systems that generate multiple Warning headers SHOULD order them with this user agent behavior in mind. Requirements for the behavior of caches with respect to Warnings are stated in Section 3.2. This is a list of the currently-defined warn-codes, each with a recommended warn-text in English, and a description of its meaning. 110 Response is stale MUST be included whenever the returned response is stale. 111 Revalidation failed MUST be included if a cache returns a stale response because an attempt to revalidate the response failed, due to an inability to reach the server. 112 Disconnected operation SHOULD be included if the cache is intentionally disconnected from the rest of the network for a period of time. 113 Heuristic expiration MUST be included if the cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours. 199 Miscellaneous warning The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action, besides presenting the warning to the user. 214 Transformation applied MUST be added by an intermediate cache or proxy if it applies any transformation changing the content-coding (as specified in the Content-Encoding header) or media-type (as specified in the Content-Type header) of the response, or the entity-body of the response, unless this Warning code already appears in the response. 299 Miscellaneous persistent warning The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action. If an implementation sends a message with one or more Warning headers whose version is HTTP/1.0 or lower, then the sender MUST include in each warning-value a warn-date that matches the date in the response. If an implementation receives a message with a warning-value that includes a warn-date, and that warn-date is different from the Date value in the response, then that warning-value MUST be deleted from the message before storing, forwarding, or using it. (This prevents bad consequences of naive caching of Warning header fields.) If all of the warning-values are deleted for this reason, the Warning header MUST be deleted as well. 17. IANA Considerations 17.1. Message Header Registration The Message Header Registry located at <http://www.iana.org/ assignments/message-headers/message-header-index.html> should be updated with the permanent registrations below (see [RFC3864]): +-------------------+----------+----------+--------------+ | Header Field Name | Protocol | Status | Reference | +-------------------+----------+----------+--------------+ | Age | http | standard | Section 16.1 | | Cache-Control | http | standard | Section 16.2 | | Expires | http | standard | Section 16.3 | | Pragma | http | standard | Section 16.4 | | Vary | http | standard | Section 16.5 | | Warning | http | standard | Section 16.6 | +-------------------+----------+----------+--------------+ The change controller is: "IETF (iesg@ietf.org) - Internet Engineering Task Force". 18. Security Considerations Caching proxies provide additional potential vulnerabilities, since the contents of the cache represent an attractive target for malicious exploitation. Because cache contents persist after an HTTP request is complete, an attack on the cache can reveal information long after a user believes that the information has been removed from the network. Therefore, cache contents should be protected as sensitive information. 19. Acknowledgments Much of the content and presentation of the caching design is due to suggestions and comments from individuals including: Shel Kaphan, Paul Leach, Koen Holtman, David Morris, and Larry Masinter. 20. References 20.1. Normative References [ISO-8859-1] International Organization for Standardization, "Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1", ISO/ IEC 8859-1:1998, 1998. [Part1] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 1: URIs, Connections, and Message Parsing", draft-ietf-httpbis-p1-messaging-05 (work in progress), November 2008. [Part2] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 2: Message Semantics", draft-ietf-httpbis-p2-semantics-05 (work in progress), November 2008. [Part3] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 3: Message Payload and Content Negotiation", draft-ietf-httpbis-p3-payload-05 (workinprogress), November 2008. [Part4] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 4: Conditional Requests", draft-ietf-httpbis-p4-conditional-05 (work[Part1], Section 4.2> port = <port, defined inprogress), November 2008. [Part5] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 5: Range Requests and Partial Responses", draft-ietf-httpbis-p5-range-05 (work[Part1], Section 2.1> pragma-directive = "no-cache" / extension-pragma pseudonym = <pseudonym, defined inprogress), November 2008. [Part7] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., and J. Reschke, Ed., "HTTP/1.1, part 7: Authentication", draft-ietf-httpbis-p7-auth-05 (work[Part1], Section 8.9> quoted-string = <quoted-string, defined inprogress), November 2008. [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text", RFC 2047, November 1996. [RFC2119] Bradner, S., "Key words for use[Part1], Section 1.2.2> token = <token, defined inRFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. 20.2. Informative References [RFC1305] Mills, D., "Network Time Protocol (Version 3) Specification, Implementation", RFC 1305, March 1992. [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration Procedures for Message Header Fields", BCP 90, RFC 3864, September 2004. Appendix A. Compatibility with Previous Versions A.1. Changes from RFC 2068 A case was missed[Part1], Section 1.2.2> uri-host = <uri-host, defined inthe[Part1], Section 2.1> warn-agent = ( uri-host [ ":" port ] ) / pseudonym warn-code = 3DIGIT warn-date = DQUOTE HTTP-date DQUOTE warn-text = quoted-string warning-value = warn-code SP warn-agent SP warn-text [ SP warn-date ] ABNF diagnostics: ; Age defined but not used ; Cache-Controlmodel of HTTP/1.1; s-maxage was introduced to add this missing case. (Sections 6, 16.2, 16.2.3) Transfer-coding and message lengths all interact in ways that required fixing exactly when chunked encoding isdefined but not used(to allow for transfer encoding that may; Expires defined but notbe self delimiting); it was important to straighten out exactly how message lengths are computed. (Section 7.2, see also [Part1], [Part3] and [Part5]) Proxies should be able to add Content-Length when appropriate. (Section 7.2) Range request responses would become very verbose if all meta-data were always returned; by allowing the server to only send needed headers in a 206 response, this problem can be avoided. (Section 7.3) The Cache-Control: max-age directive wasused ; Pragma defined but notproperlyused ; Vary definedfor responses. (Section 16.2.3) Warnings could be cached incorrectly, orbut notupdated appropriately. (Section 3.2, 4.4, 7.2, 7.3, 16.2.3, and 16.6)used ; Warningalso needed to be a general header, as PUT or other methods may have need for it in requests. A.2. Changes from RFC 2616 Clarify denial of service attack avoidance requirement. (Section 12)defined but not used AppendixB.C. Change Log (to be removed by RFC Editor before publication)B.1.C.1. Since RFC2616 Extracted relevant partitions from [RFC2616].B.2.C.2. Since draft-ietf-httpbis-p6-cache-00 Closed issues: o <http://tools.ietf.org/wg/httpbis/trac/ticket/9>: "Trailer" (<http://purl.org/NET/http-errata#trailer-hop>) o <http://tools.ietf.org/wg/httpbis/trac/ticket/12>: "Invalidation after Update or Delete" (<http://purl.org/NET/http-errata#invalidupd>) o <http://tools.ietf.org/wg/httpbis/trac/ticket/35>: "Normative and Informative references" o <http://tools.ietf.org/wg/httpbis/trac/ticket/48>: "Date reference typo" o <http://tools.ietf.org/wg/httpbis/trac/ticket/49>: "Connection header text" o <http://tools.ietf.org/wg/httpbis/trac/ticket/65>: "Informative references" o <http://tools.ietf.org/wg/httpbis/trac/ticket/66>: "ISO-8859-1 Reference" o <http://tools.ietf.org/wg/httpbis/trac/ticket/86>: "Normative up- to-date references" o <http://tools.ietf.org/wg/httpbis/trac/ticket/87>: "typo in 13.2.2" Other changes: o Use names of RFC4234 core rules DQUOTE and HTAB (work in progress on <http://tools.ietf.org/wg/httpbis/trac/ticket/36>)B.3.C.3. Since draft-ietf-httpbis-p6-cache-01 Closed issues: o <http://tools.ietf.org/wg/httpbis/trac/ticket/82>: "rel_path not used" Other changes: o Get rid of duplicate BNF rule names ("host" -> "uri-host") (work in progress on <http://tools.ietf.org/wg/httpbis/trac/ticket/36>) o Add explicit references to BNF syntax and rules imported from other parts of the specification.B.4.C.4. Since draft-ietf-httpbis-p6-cache-02 Ongoing work on IANA Message Header Registration (<http://tools.ietf.org/wg/httpbis/trac/ticket/40>): o Reference RFC 3984, and update header registrations for headers defined in this document.B.5.C.5. Since draft-ietf-httpbis-p6-cache-03 Closed issues: o <http://tools.ietf.org/wg/httpbis/trac/ticket/106>: "Vary header classification"B.6.C.6. Since draft-ietf-httpbis-p6-cache-04 Ongoing work on ABNF conversion (<http://tools.ietf.org/wg/httpbis/trac/ticket/36>): o Use "/" instead of "|" for alternatives. o Introduce new ABNF rules for "bad" whitespace ("BWS"), optional whitespace ("OWS") and required whitespace ("RWS"). o Rewrite ABNFs to spell out whitespace rules, factor out header value format definitions. C.7. Since draft-ietf-httpbis-p6-cache-05 This is a total rewrite of this part of the specification. Affected issues: o <http://tools.ietf.org/wg/httpbis/trac/ticket/54>: "Definition of 1xx Warn-Codes" o <http://trac.tools.ietf.org/wg/httpbis/trac/ticket/60>: "Placement of 13.5.1 and 13.5.2" o <http://trac.tools.ietf.org/wg/httpbis/trac/ticket/138>: "The role of Warning and Semantic Transparency in Caching" o <http://trac.tools.ietf.org/wg/httpbis/trac/ticket/139>: "Methods and Caching" In addition: Final work on ABNF conversion (<http://tools.ietf.org/wg/httpbis/trac/ticket/36>): o Add appendix containing collected and expanded ABNF, reorganize ABNF introduction. Index A age76 Age header2717 C cache 5 Cache Directives max-age32-3318, 21 max-stale3219 min-fresh3219 must-revalidate3421 no-cache2918, 20 no-store3018, 21 no-transform3519, 22 only-if-cached3419 private2920 proxy-revalidate3521 public2920 s-maxage3122 Cache-Control header2717 cacheable65 E Expires header3723 explicit expiration time75 F first-hand 6 fresh76 freshness lifetime76 G Grammar Age2717 Age-v2717 Cache-Control2818 Cache-Control-v28 cache-directive 2818 cache-extension2818 cache-request-directive2818 cache-response-directive2820 delta-seconds2717 Expires3723 Expires-v3723 extension-pragma3824 Pragma3824 pragma-directive3824 Pragma-v3824 Vary3924 Vary-v3924 warn-agent4025 warn-code4025 warn-date4025 warn-text4025 Warning4025 Warning-v4025 warning-value4025 H Headers Age2717 Cache-Control2717 Expires3723 Pragma3823 Vary3824 Warning3925 heuristic expiration time75 M max-age Cache Directive32-3318, 21 max-stale Cache Directive3219 min-fresh Cache Directive3219 must-revalidate Cache Directive3421 N no-cache Cache Directive2918, 20 no-store Cache Directive3018, 21 no-transform Cache Directive3519, 22 O only-if-cached Cache Directive3419 P Pragma header3823 private Cache Directive2920 proxy-revalidate Cache Directive3521 public Cache Directive2920 S s-maxage Cache Directive31 semantically transparent 522 stale76 V validator76 Vary header3824 W Warning header3925 Authors' Addresses Roy T. Fielding (editor) Day Software 23 Corporate Plaza DR, Suite 280 Newport Beach, CA 92660 USA Phone: +1-949-706-5300 Fax: +1-949-706-5305 Email: fielding@gbiv.com URI: http://roy.gbiv.com/ Jim Gettys One Laptop per Child 21 Oak Knoll Road Carlisle, MA 01741 USA Email: jg@laptop.org URI: http://www.laptop.org/ Jeffrey C. Mogul Hewlett-Packard Company HP Labs, Large Scale Systems Group 1501 Page Mill Road, MS 1177 Palo Alto, CA 94304 USA Email: JeffMogul@acm.org Henrik Frystyk Nielsen Microsoft Corporation 1 Microsoft Way Redmond, WA 98052 USA Email: henrikn@microsoft.com Larry Masinter Adobe Systems, Incorporated 345 Park Ave San Jose, CA 95110 USA Email: LMM@acm.org URI: http://larry.masinter.net/ Paul J. Leach Microsoft Corporation 1 Microsoft Way Redmond, WA 98052 Email: paulle@microsoft.com Tim Berners-Lee World Wide Web Consortium MIT Computer Science and Artificial Intelligence Laboratory The Stata Center, Building 32 32 Vassar Street Cambridge, MA 02139 USA Email: timbl@w3.org URI: http://www.w3.org/People/Berners-Lee/ Yves Lafon (editor) World Wide Web Consortium W3C / ERCIM 2004, rte des Lucioles Sophia-Antipolis, AM 06902 France Email: ylafon@w3.org URI: http://www.raubacapeu.net/people/yves/ Julian F. Reschke (editor) greenbytes GmbH Hafenweg 16 Muenster, NW 48155 Germany Phone: +49 251 2807760 Fax: +49 251 2807761 Email: julian.reschke@greenbytes.de URI: http://greenbytes.de/tech/webdav/Full Copyright Statement Copyright (C) The IETF Trust (2008). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Intellectual Property The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.