1 | |
---|
2 | |
---|
3 | |
---|
4 | Network Working Group R. Fielding, Ed. |
---|
5 | Internet-Draft Day Software |
---|
6 | Obsoletes: 2616 (if approved) J. Gettys |
---|
7 | Intended status: Standards Track One Laptop per Child |
---|
8 | Expires: December 19, 2008 J. Mogul |
---|
9 | HP |
---|
10 | H. Frystyk |
---|
11 | Microsoft |
---|
12 | L. Masinter |
---|
13 | Adobe Systems |
---|
14 | P. Leach |
---|
15 | Microsoft |
---|
16 | T. Berners-Lee |
---|
17 | W3C/MIT |
---|
18 | Y. Lafon, Ed. |
---|
19 | W3C |
---|
20 | J. Reschke, Ed. |
---|
21 | greenbytes |
---|
22 | June 17, 2008 |
---|
23 | |
---|
24 | |
---|
25 | HTTP/1.1, part 6: Caching |
---|
26 | draft-ietf-httpbis-p6-cache-03 |
---|
27 | |
---|
28 | Status of this Memo |
---|
29 | |
---|
30 | By submitting this Internet-Draft, each author represents that any |
---|
31 | applicable patent or other IPR claims of which he or she is aware |
---|
32 | have been or will be disclosed, and any of which he or she becomes |
---|
33 | aware will be disclosed, in accordance with Section 6 of BCP 79. |
---|
34 | |
---|
35 | Internet-Drafts are working documents of the Internet Engineering |
---|
36 | Task Force (IETF), its areas, and its working groups. Note that |
---|
37 | other groups may also distribute working documents as Internet- |
---|
38 | Drafts. |
---|
39 | |
---|
40 | Internet-Drafts are draft documents valid for a maximum of six months |
---|
41 | and may be updated, replaced, or obsoleted by other documents at any |
---|
42 | time. It is inappropriate to use Internet-Drafts as reference |
---|
43 | material or to cite them other than as "work in progress." |
---|
44 | |
---|
45 | The list of current Internet-Drafts can be accessed at |
---|
46 | http://www.ietf.org/ietf/1id-abstracts.txt. |
---|
47 | |
---|
48 | The list of Internet-Draft Shadow Directories can be accessed at |
---|
49 | http://www.ietf.org/shadow.html. |
---|
50 | |
---|
51 | This Internet-Draft will expire on December 19, 2008. |
---|
52 | |
---|
53 | |
---|
54 | |
---|
55 | Fielding, et al. Expires December 19, 2008 [Page 1] |
---|
56 | |
---|
57 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
58 | |
---|
59 | |
---|
60 | Abstract |
---|
61 | |
---|
62 | The Hypertext Transfer Protocol (HTTP) is an application-level |
---|
63 | protocol for distributed, collaborative, hypermedia information |
---|
64 | systems. HTTP has been in use by the World Wide Web global |
---|
65 | information initiative since 1990. This document is Part 6 of the |
---|
66 | seven-part specification that defines the protocol referred to as |
---|
67 | "HTTP/1.1" and, taken together, obsoletes RFC 2616. Part 6 defines |
---|
68 | requirements on HTTP caches and the associated header fields that |
---|
69 | control cache behavior or indicate cacheable response messages. |
---|
70 | |
---|
71 | Editorial Note (To be removed by RFC Editor) |
---|
72 | |
---|
73 | Discussion of this draft should take place on the HTTPBIS working |
---|
74 | group mailing list (ietf-http-wg@w3.org). The current issues list is |
---|
75 | at <http://www.tools.ietf.org/wg/httpbis/trac/report/11> and related |
---|
76 | documents (including fancy diffs) can be found at |
---|
77 | <http://www.tools.ietf.org/wg/httpbis/>. |
---|
78 | |
---|
79 | The changes in this draft are summarized in Appendix B.4. |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | Fielding, et al. Expires December 19, 2008 [Page 2] |
---|
112 | |
---|
113 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
114 | |
---|
115 | |
---|
116 | Table of Contents |
---|
117 | |
---|
118 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 |
---|
119 | 1.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . . . 5 |
---|
120 | 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 6 |
---|
121 | 1.3. Requirements . . . . . . . . . . . . . . . . . . . . . . . 7 |
---|
122 | 2. Notational Conventions and Generic Grammar . . . . . . . . . . 8 |
---|
123 | 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 |
---|
124 | 3.1. Cache Correctness . . . . . . . . . . . . . . . . . . . . 8 |
---|
125 | 3.2. Warnings . . . . . . . . . . . . . . . . . . . . . . . . . 9 |
---|
126 | 3.3. Cache-control Mechanisms . . . . . . . . . . . . . . . . . 10 |
---|
127 | 3.4. Explicit User Agent Warnings . . . . . . . . . . . . . . . 10 |
---|
128 | 3.5. Exceptions to the Rules and Warnings . . . . . . . . . . . 11 |
---|
129 | 3.6. Client-controlled Behavior . . . . . . . . . . . . . . . . 11 |
---|
130 | 4. Expiration Model . . . . . . . . . . . . . . . . . . . . . . . 12 |
---|
131 | 4.1. Server-Specified Expiration . . . . . . . . . . . . . . . 12 |
---|
132 | 4.2. Heuristic Expiration . . . . . . . . . . . . . . . . . . . 13 |
---|
133 | 4.3. Age Calculations . . . . . . . . . . . . . . . . . . . . . 13 |
---|
134 | 4.4. Expiration Calculations . . . . . . . . . . . . . . . . . 15 |
---|
135 | 4.5. Disambiguating Expiration Values . . . . . . . . . . . . . 16 |
---|
136 | 4.6. Disambiguating Multiple Responses . . . . . . . . . . . . 17 |
---|
137 | 5. Validation Model . . . . . . . . . . . . . . . . . . . . . . . 17 |
---|
138 | 6. Response Cacheability . . . . . . . . . . . . . . . . . . . . 18 |
---|
139 | 7. Constructing Responses From Caches . . . . . . . . . . . . . . 19 |
---|
140 | 7.1. End-to-end and Hop-by-hop Headers . . . . . . . . . . . . 19 |
---|
141 | 7.2. Non-modifiable Headers . . . . . . . . . . . . . . . . . . 20 |
---|
142 | 7.3. Combining Headers . . . . . . . . . . . . . . . . . . . . 21 |
---|
143 | 8. Caching Negotiated Responses . . . . . . . . . . . . . . . . . 22 |
---|
144 | 9. Shared and Non-Shared Caches . . . . . . . . . . . . . . . . . 23 |
---|
145 | 10. Errors or Incomplete Response Cache Behavior . . . . . . . . . 24 |
---|
146 | 11. Side Effects of GET and HEAD . . . . . . . . . . . . . . . . . 24 |
---|
147 | 12. Invalidation After Updates or Deletions . . . . . . . . . . . 24 |
---|
148 | 13. Write-Through Mandatory . . . . . . . . . . . . . . . . . . . 25 |
---|
149 | 14. Cache Replacement . . . . . . . . . . . . . . . . . . . . . . 26 |
---|
150 | 15. History Lists . . . . . . . . . . . . . . . . . . . . . . . . 26 |
---|
151 | 16. Header Field Definitions . . . . . . . . . . . . . . . . . . . 27 |
---|
152 | 16.1. Age . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 |
---|
153 | 16.2. Cache-Control . . . . . . . . . . . . . . . . . . . . . . 27 |
---|
154 | 16.2.1. What is Cacheable . . . . . . . . . . . . . . . . . . 29 |
---|
155 | 16.2.2. What May be Stored by Caches . . . . . . . . . . . . 30 |
---|
156 | 16.2.3. Modifications of the Basic Expiration Mechanism . . . 31 |
---|
157 | 16.2.4. Cache Revalidation and Reload Controls . . . . . . . 33 |
---|
158 | 16.2.5. No-Transform Directive . . . . . . . . . . . . . . . 35 |
---|
159 | 16.2.6. Cache Control Extensions . . . . . . . . . . . . . . 36 |
---|
160 | 16.3. Expires . . . . . . . . . . . . . . . . . . . . . . . . . 37 |
---|
161 | 16.4. Pragma . . . . . . . . . . . . . . . . . . . . . . . . . . 38 |
---|
162 | 16.5. Vary . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 |
---|
163 | 16.6. Warning . . . . . . . . . . . . . . . . . . . . . . . . . 39 |
---|
164 | |
---|
165 | |
---|
166 | |
---|
167 | Fielding, et al. Expires December 19, 2008 [Page 3] |
---|
168 | |
---|
169 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
170 | |
---|
171 | |
---|
172 | 17. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 42 |
---|
173 | 17.1. Message Header Registration . . . . . . . . . . . . . . . 42 |
---|
174 | 18. Security Considerations . . . . . . . . . . . . . . . . . . . 42 |
---|
175 | 19. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 43 |
---|
176 | 20. References . . . . . . . . . . . . . . . . . . . . . . . . . . 43 |
---|
177 | 20.1. Normative References . . . . . . . . . . . . . . . . . . . 43 |
---|
178 | 20.2. Informative References . . . . . . . . . . . . . . . . . . 44 |
---|
179 | Appendix A. Compatibility with Previous Versions . . . . . . . . 44 |
---|
180 | A.1. Changes from RFC 2068 . . . . . . . . . . . . . . . . . . 44 |
---|
181 | A.2. Changes from RFC 2616 . . . . . . . . . . . . . . . . . . 45 |
---|
182 | Appendix B. Change Log (to be removed by RFC Editor before |
---|
183 | publication) . . . . . . . . . . . . . . . . . . . . 45 |
---|
184 | B.1. Since RFC2616 . . . . . . . . . . . . . . . . . . . . . . 45 |
---|
185 | B.2. Since draft-ietf-httpbis-p6-cache-00 . . . . . . . . . . . 45 |
---|
186 | B.3. Since draft-ietf-httpbis-p6-cache-01 . . . . . . . . . . . 46 |
---|
187 | B.4. Since draft-ietf-httpbis-p6-cache-02 . . . . . . . . . . . 46 |
---|
188 | Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 |
---|
189 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 49 |
---|
190 | Intellectual Property and Copyright Statements . . . . . . . . . . 52 |
---|
191 | |
---|
192 | |
---|
193 | |
---|
194 | |
---|
195 | |
---|
196 | |
---|
197 | |
---|
198 | |
---|
199 | |
---|
200 | |
---|
201 | |
---|
202 | |
---|
203 | |
---|
204 | |
---|
205 | |
---|
206 | |
---|
207 | |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | |
---|
212 | |
---|
213 | |
---|
214 | |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | |
---|
219 | |
---|
220 | |
---|
221 | |
---|
222 | |
---|
223 | Fielding, et al. Expires December 19, 2008 [Page 4] |
---|
224 | |
---|
225 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
226 | |
---|
227 | |
---|
228 | 1. Introduction |
---|
229 | |
---|
230 | HTTP is typically used for distributed information systems, where |
---|
231 | performance can be improved by the use of response caches, and |
---|
232 | includes a number of elements intended to make caching work as well |
---|
233 | as possible. Because these elements interact with each other, it is |
---|
234 | useful to describe the caching design of HTTP separately. This |
---|
235 | document defines aspects of HTTP/1.1 related to caching and reusing |
---|
236 | response messages. |
---|
237 | |
---|
238 | 1.1. Purpose |
---|
239 | |
---|
240 | An HTTP cache is a local store of response messages and the subsystem |
---|
241 | that controls its message storage, retrieval, and deletion. A cache |
---|
242 | stores cacheable responses in order to reduce the response time and |
---|
243 | network bandwidth consumption on future, equivalent requests. Any |
---|
244 | client or server may include a cache, though a cache cannot be used |
---|
245 | by a server that is acting as a tunnel. |
---|
246 | |
---|
247 | Caching would be useless if it did not significantly improve |
---|
248 | performance. The goal of caching in HTTP/1.1 is to reuse a prior |
---|
249 | response message to satisfy a current request. In some cases, the |
---|
250 | existing response can be reused without the need for a network |
---|
251 | request, reducing latency and network round-trips; we use an |
---|
252 | "expiration" mechanism for this purpose (see Section 4). Even when a |
---|
253 | new request is required, it is often possible to reuse all or parts |
---|
254 | of the payload of a prior response to satisfy the request, thereby |
---|
255 | reducing network bandwidth usage; we use a "validation" mechanism for |
---|
256 | this purpose (see Section 5). |
---|
257 | |
---|
258 | A cache behaves in a "semantically transparent" manner, with respect |
---|
259 | to a particular response, when its use affects neither the requesting |
---|
260 | client nor the origin server, except to improve performance. When a |
---|
261 | cache is semantically transparent, the client receives exactly the |
---|
262 | same response status and payload that it would have received had its |
---|
263 | request been handled directly by the origin server. |
---|
264 | |
---|
265 | In an ideal world, all interactions with an HTTP cache would be |
---|
266 | semantically transparent. However, for some resources, semantic |
---|
267 | transparency is not always necessary and can be effectively traded |
---|
268 | for the sake of bandwidth scaling, disconnected operation, and high |
---|
269 | availability. HTTP/1.1 allows origin servers, caches, and clients to |
---|
270 | explicitly reduce transparency when necessary. However, because non- |
---|
271 | transparent operation may confuse non-expert users and might be |
---|
272 | incompatible with certain server applications (such as those for |
---|
273 | ordering merchandise), the protocol requires that transparency be |
---|
274 | relaxed |
---|
275 | |
---|
276 | |
---|
277 | |
---|
278 | |
---|
279 | Fielding, et al. Expires December 19, 2008 [Page 5] |
---|
280 | |
---|
281 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
282 | |
---|
283 | |
---|
284 | o only by an explicit protocol-level request when relaxed by client |
---|
285 | or origin server |
---|
286 | |
---|
287 | o only with an explicit warning to the end user when relaxed by |
---|
288 | cache or client |
---|
289 | |
---|
290 | Therefore, HTTP/1.1 provides these important elements: |
---|
291 | |
---|
292 | 1. Protocol features that provide full semantic transparency when |
---|
293 | this is required by all parties. |
---|
294 | |
---|
295 | 2. Protocol features that allow an origin server or user agent to |
---|
296 | explicitly request and control non-transparent operation. |
---|
297 | |
---|
298 | 3. Protocol features that allow a cache to attach warnings to |
---|
299 | responses that do not preserve the requested approximation of |
---|
300 | semantic transparency. |
---|
301 | |
---|
302 | A basic principle is that it must be possible for the clients to |
---|
303 | detect any potential relaxation of semantic transparency. |
---|
304 | |
---|
305 | Note: The server, cache, or client implementor might be faced with |
---|
306 | design decisions not explicitly discussed in this specification. |
---|
307 | If a decision might affect semantic transparency, the implementor |
---|
308 | ought to err on the side of maintaining transparency unless a |
---|
309 | careful and complete analysis shows significant benefits in |
---|
310 | breaking transparency. |
---|
311 | |
---|
312 | 1.2. Terminology |
---|
313 | |
---|
314 | This specification uses a number of terms to refer to the roles |
---|
315 | played by participants in, and objects of, HTTP caching. |
---|
316 | |
---|
317 | cacheable |
---|
318 | |
---|
319 | A response is cacheable if a cache is allowed to store a copy of |
---|
320 | the response message for use in answering subsequent requests. |
---|
321 | Even when a response is cacheable, there may be additional |
---|
322 | constraints on whether a cache can use the cached copy for a |
---|
323 | particular request. |
---|
324 | |
---|
325 | first-hand |
---|
326 | |
---|
327 | A response is first-hand if it comes directly and without |
---|
328 | unnecessary delay from the origin server, perhaps via one or more |
---|
329 | proxies. A response is also first-hand if its validity has just |
---|
330 | been checked directly with the origin server. |
---|
331 | |
---|
332 | |
---|
333 | |
---|
334 | |
---|
335 | Fielding, et al. Expires December 19, 2008 [Page 6] |
---|
336 | |
---|
337 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
338 | |
---|
339 | |
---|
340 | explicit expiration time |
---|
341 | |
---|
342 | The time at which the origin server intends that an entity should |
---|
343 | no longer be returned by a cache without further validation. |
---|
344 | |
---|
345 | heuristic expiration time |
---|
346 | |
---|
347 | An expiration time assigned by a cache when no explicit expiration |
---|
348 | time is available. |
---|
349 | |
---|
350 | age |
---|
351 | |
---|
352 | The age of a response is the time since it was sent by, or |
---|
353 | successfully validated with, the origin server. |
---|
354 | |
---|
355 | freshness lifetime |
---|
356 | |
---|
357 | The length of time between the generation of a response and its |
---|
358 | expiration time. |
---|
359 | |
---|
360 | fresh |
---|
361 | |
---|
362 | A response is fresh if its age has not yet exceeded its freshness |
---|
363 | lifetime. |
---|
364 | |
---|
365 | stale |
---|
366 | |
---|
367 | A response is stale if its age has passed its freshness lifetime. |
---|
368 | |
---|
369 | validator |
---|
370 | |
---|
371 | A protocol element (e.g., an entity tag or a Last-Modified time) |
---|
372 | that is used to find out whether a cache entry is an equivalent |
---|
373 | copy of an entity. |
---|
374 | |
---|
375 | 1.3. Requirements |
---|
376 | |
---|
377 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
---|
378 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this |
---|
379 | document are to be interpreted as described in [RFC2119]. |
---|
380 | |
---|
381 | An implementation is not compliant if it fails to satisfy one or more |
---|
382 | of the MUST or REQUIRED level requirements for the protocols it |
---|
383 | implements. An implementation that satisfies all the MUST or |
---|
384 | REQUIRED level and all the SHOULD level requirements for its |
---|
385 | protocols is said to be "unconditionally compliant"; one that |
---|
386 | satisfies all the MUST level requirements but not all the SHOULD |
---|
387 | level requirements for its protocols is said to be "conditionally |
---|
388 | |
---|
389 | |
---|
390 | |
---|
391 | Fielding, et al. Expires December 19, 2008 [Page 7] |
---|
392 | |
---|
393 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
394 | |
---|
395 | |
---|
396 | compliant." |
---|
397 | |
---|
398 | |
---|
399 | 2. Notational Conventions and Generic Grammar |
---|
400 | |
---|
401 | This specification uses the ABNF syntax defined in Section 2.1 of |
---|
402 | [Part1] and the core rules defined in Section 2.2 of [Part1]: |
---|
403 | [[abnf.dep: ABNF syntax and basic rules will be adopted from RFC |
---|
404 | 5234, see <http://tools.ietf.org/wg/httpbis/trac/ticket/36>.]] |
---|
405 | |
---|
406 | DIGIT = <DIGIT, defined in [Part1], Section 2.2> |
---|
407 | DQUOTE = <DQUOTE, defined in [Part1], Section 2.2> |
---|
408 | SP = <SP, defined in [Part1], Section 2.2> |
---|
409 | |
---|
410 | |
---|
411 | quoted-string = <quoted-string, defined in [Part1], Section 2.2> |
---|
412 | token = <token, defined in [Part1], Section 2.2> |
---|
413 | |
---|
414 | The ABNF rules below are defined in other parts: |
---|
415 | |
---|
416 | field-name = <field-name, defined in [Part1], Section 4.2> |
---|
417 | HTTP-date = <HTTP-date, defined in [Part1], Section 3.3.1> |
---|
418 | port = <port, defined in [Part1], Section 3.2.1> |
---|
419 | pseudonym = <pseudonym, defined in [Part1], Section 8.9> |
---|
420 | uri-host = <uri-host, defined in [Part1], Section 3.2.1> |
---|
421 | |
---|
422 | |
---|
423 | 3. Overview |
---|
424 | |
---|
425 | 3.1. Cache Correctness |
---|
426 | |
---|
427 | A correct cache MUST respond to a request with the most up-to-date |
---|
428 | response held by the cache that is appropriate to the request (see |
---|
429 | Sections 4.5, 4.6, and 14) which meets one of the following |
---|
430 | conditions: |
---|
431 | |
---|
432 | 1. It has been checked for equivalence with what the origin server |
---|
433 | would have returned by revalidating the response with the origin |
---|
434 | server (Section 5); |
---|
435 | |
---|
436 | 2. It is "fresh enough" (see Section 4). In the default case, this |
---|
437 | means it meets the least restrictive freshness requirement of the |
---|
438 | client, origin server, and cache (see Section 16.2); if the |
---|
439 | origin server so specifies, it is the freshness requirement of |
---|
440 | the origin server alone. If a stored response is not "fresh |
---|
441 | enough" by the most restrictive freshness requirement of both the |
---|
442 | client and the origin server, in carefully considered |
---|
443 | circumstances the cache MAY still return the response with the |
---|
444 | |
---|
445 | |
---|
446 | |
---|
447 | Fielding, et al. Expires December 19, 2008 [Page 8] |
---|
448 | |
---|
449 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
450 | |
---|
451 | |
---|
452 | appropriate Warning header (see Sections 3.5 and 16.6), unless |
---|
453 | such a response is prohibited (e.g., by a "no-store" cache- |
---|
454 | directive, or by a "no-cache" cache-request-directive; see |
---|
455 | Section 16.2). |
---|
456 | |
---|
457 | 3. It is an appropriate 304 (Not Modified), 305 (Use Proxy), or |
---|
458 | error (4xx or 5xx) response message. |
---|
459 | |
---|
460 | If the cache can not communicate with the origin server, then a |
---|
461 | correct cache SHOULD respond as above if the response can be |
---|
462 | correctly served from the cache; if not it MUST return an error or |
---|
463 | warning indicating that there was a communication failure. |
---|
464 | |
---|
465 | If a cache receives a response (either an entire response, or a 304 |
---|
466 | (Not Modified) response) that it would normally forward to the |
---|
467 | requesting client, and the received response is no longer fresh, the |
---|
468 | cache SHOULD forward it to the requesting client without adding a new |
---|
469 | Warning (but without removing any existing Warning headers). A cache |
---|
470 | SHOULD NOT attempt to revalidate a response simply because that |
---|
471 | response became stale in transit; this might lead to an infinite |
---|
472 | loop. A user agent that receives a stale response without a Warning |
---|
473 | MAY display a warning indication to the user. |
---|
474 | |
---|
475 | 3.2. Warnings |
---|
476 | |
---|
477 | Whenever a cache returns a response that is neither first-hand nor |
---|
478 | "fresh enough" (in the sense of condition 2 in Section 3.1), it MUST |
---|
479 | attach a warning to that effect, using a Warning general-header. The |
---|
480 | Warning header and the currently defined warnings are described in |
---|
481 | Section 16.6. The warning allows clients to take appropriate action. |
---|
482 | |
---|
483 | Warnings MAY be used for other purposes, both cache-related and |
---|
484 | otherwise. The use of a warning, rather than an error status code, |
---|
485 | distinguish these responses from true failures. |
---|
486 | |
---|
487 | Warnings are assigned three digit warn-codes. The first digit |
---|
488 | indicates whether the Warning MUST or MUST NOT be deleted from a |
---|
489 | stored cache entry after a successful revalidation: |
---|
490 | |
---|
491 | 1xx Warnings that describe the freshness or revalidation status of |
---|
492 | the response, and so MUST be deleted after a successful |
---|
493 | revalidation. 1xx warn-codes MAY be generated by a cache only when |
---|
494 | validating a cached entry. It MUST NOT be generated by clients. |
---|
495 | |
---|
496 | 2xx Warnings that describe some aspect of the entity body or entity |
---|
497 | headers that is not rectified by a revalidation (for example, a |
---|
498 | lossy compression of the entity bodies) and which MUST NOT be |
---|
499 | deleted after a successful revalidation. |
---|
500 | |
---|
501 | |
---|
502 | |
---|
503 | Fielding, et al. Expires December 19, 2008 [Page 9] |
---|
504 | |
---|
505 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
506 | |
---|
507 | |
---|
508 | See Section 16.6 for the definitions of the codes themselves. |
---|
509 | |
---|
510 | HTTP/1.0 caches will cache all Warnings in responses, without |
---|
511 | deleting the ones in the first category. Warnings in responses that |
---|
512 | are passed to HTTP/1.0 caches carry an extra warning-date field, |
---|
513 | which prevents a future HTTP/1.1 recipient from believing an |
---|
514 | erroneously cached Warning. |
---|
515 | |
---|
516 | Warnings also carry a warning text. The text MAY be in any |
---|
517 | appropriate natural language (perhaps based on the client's Accept |
---|
518 | headers), and include an OPTIONAL indication of what character set is |
---|
519 | used. |
---|
520 | |
---|
521 | Multiple warnings MAY be attached to a response (either by the origin |
---|
522 | server or by a cache), including multiple warnings with the same code |
---|
523 | number. For example, a server might provide the same warning with |
---|
524 | texts in both English and Basque. |
---|
525 | |
---|
526 | When multiple warnings are attached to a response, it might not be |
---|
527 | practical or reasonable to display all of them to the user. This |
---|
528 | version of HTTP does not specify strict priority rules for deciding |
---|
529 | which warnings to display and in what order, but does suggest some |
---|
530 | heuristics. |
---|
531 | |
---|
532 | 3.3. Cache-control Mechanisms |
---|
533 | |
---|
534 | The basic cache mechanisms in HTTP/1.1 (server-specified expiration |
---|
535 | times and validators) are implicit directives to caches. In some |
---|
536 | cases, a server or client might need to provide explicit directives |
---|
537 | to the HTTP caches. We use the Cache-Control header for this |
---|
538 | purpose. |
---|
539 | |
---|
540 | The Cache-Control header allows a client or server to transmit a |
---|
541 | variety of directives in either requests or responses. These |
---|
542 | directives typically override the default caching algorithms. As a |
---|
543 | general rule, if there is any apparent conflict between header |
---|
544 | values, the most restrictive interpretation is applied (that is, the |
---|
545 | one that is most likely to preserve semantic transparency). However, |
---|
546 | in some cases, cache-control directives are explicitly specified as |
---|
547 | weakening the approximation of semantic transparency (for example, |
---|
548 | "max-stale" or "public"). |
---|
549 | |
---|
550 | The cache-control directives are described in detail in Section 16.2. |
---|
551 | |
---|
552 | 3.4. Explicit User Agent Warnings |
---|
553 | |
---|
554 | Many user agents make it possible for users to override the basic |
---|
555 | caching mechanisms. For example, the user agent might allow the user |
---|
556 | |
---|
557 | |
---|
558 | |
---|
559 | Fielding, et al. Expires December 19, 2008 [Page 10] |
---|
560 | |
---|
561 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
562 | |
---|
563 | |
---|
564 | to specify that cached entities (even explicitly stale ones) are |
---|
565 | never validated. Or the user agent might habitually add "Cache- |
---|
566 | Control: max-stale=3600" to every request. The user agent SHOULD NOT |
---|
567 | default to either non-transparent behavior, or behavior that results |
---|
568 | in abnormally ineffective caching, but MAY be explicitly configured |
---|
569 | to do so by an explicit action of the user. |
---|
570 | |
---|
571 | If the user has overridden the basic caching mechanisms, the user |
---|
572 | agent SHOULD explicitly indicate to the user whenever this results in |
---|
573 | the display of information that might not meet the server's |
---|
574 | transparency requirements (in particular, if the displayed entity is |
---|
575 | known to be stale). Since the protocol normally allows the user |
---|
576 | agent to determine if responses are stale or not, this indication |
---|
577 | need only be displayed when this actually happens. The indication |
---|
578 | need not be a dialog box; it could be an icon (for example, a picture |
---|
579 | of a rotting fish) or some other indicator. |
---|
580 | |
---|
581 | If the user has overridden the caching mechanisms in a way that would |
---|
582 | abnormally reduce the effectiveness of caches, the user agent SHOULD |
---|
583 | continually indicate this state to the user (for example, by a |
---|
584 | display of a picture of currency in flames) so that the user does not |
---|
585 | inadvertently consume excess resources or suffer from excessive |
---|
586 | latency. |
---|
587 | |
---|
588 | 3.5. Exceptions to the Rules and Warnings |
---|
589 | |
---|
590 | In some cases, the operator of a cache MAY choose to configure it to |
---|
591 | return stale responses even when not requested by clients. This |
---|
592 | decision ought not be made lightly, but may be necessary for reasons |
---|
593 | of availability or performance, especially when the cache is poorly |
---|
594 | connected to the origin server. Whenever a cache returns a stale |
---|
595 | response, it MUST mark it as such (using a Warning header) enabling |
---|
596 | the client software to alert the user that there might be a potential |
---|
597 | problem. |
---|
598 | |
---|
599 | It also allows the user agent to take steps to obtain a first-hand or |
---|
600 | fresh response. For this reason, a cache SHOULD NOT return a stale |
---|
601 | response if the client explicitly requests a first-hand or fresh one, |
---|
602 | unless it is impossible to comply for technical or policy reasons. |
---|
603 | |
---|
604 | 3.6. Client-controlled Behavior |
---|
605 | |
---|
606 | While the origin server (and to a lesser extent, intermediate caches, |
---|
607 | by their contribution to the age of a response) are the primary |
---|
608 | source of expiration information, in some cases the client might need |
---|
609 | to control a cache's decision about whether to return a cached |
---|
610 | response without validating it. Clients do this using several |
---|
611 | directives of the Cache-Control header. |
---|
612 | |
---|
613 | |
---|
614 | |
---|
615 | Fielding, et al. Expires December 19, 2008 [Page 11] |
---|
616 | |
---|
617 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
618 | |
---|
619 | |
---|
620 | A client's request MAY specify the maximum age it is willing to |
---|
621 | accept of an unvalidated response; specifying a value of zero forces |
---|
622 | the cache(s) to revalidate all responses. A client MAY also specify |
---|
623 | the minimum time remaining before a response expires. Both of these |
---|
624 | options increase constraints on the behavior of caches, and so cannot |
---|
625 | further relax the cache's approximation of semantic transparency. |
---|
626 | |
---|
627 | A client MAY also specify that it will accept stale responses, up to |
---|
628 | some maximum amount of staleness. This loosens the constraints on |
---|
629 | the caches, and so might violate the origin server's specified |
---|
630 | constraints on semantic transparency, but might be necessary to |
---|
631 | support disconnected operation, or high availability in the face of |
---|
632 | poor connectivity. |
---|
633 | |
---|
634 | |
---|
635 | 4. Expiration Model |
---|
636 | |
---|
637 | 4.1. Server-Specified Expiration |
---|
638 | |
---|
639 | HTTP caching works best when caches can entirely avoid making |
---|
640 | requests to the origin server. The primary mechanism for avoiding |
---|
641 | requests is for an origin server to provide an explicit expiration |
---|
642 | time in the future, indicating that a response MAY be used to satisfy |
---|
643 | subsequent requests. In other words, a cache can return a fresh |
---|
644 | response without first contacting the server. |
---|
645 | |
---|
646 | Our expectation is that servers will assign future explicit |
---|
647 | expiration times to responses in the belief that the entity is not |
---|
648 | likely to change, in a semantically significant way, before the |
---|
649 | expiration time is reached. This normally preserves semantic |
---|
650 | transparency, as long as the server's expiration times are carefully |
---|
651 | chosen. |
---|
652 | |
---|
653 | The expiration mechanism applies only to responses taken from a cache |
---|
654 | and not to first-hand responses forwarded immediately to the |
---|
655 | requesting client. |
---|
656 | |
---|
657 | If an origin server wishes to force a semantically transparent cache |
---|
658 | to validate every request, it MAY assign an explicit expiration time |
---|
659 | in the past. This means that the response is always stale, and so |
---|
660 | the cache SHOULD validate it before using it for subsequent requests. |
---|
661 | See Section 16.2.4 for a more restrictive way to force revalidation. |
---|
662 | |
---|
663 | If an origin server wishes to force any HTTP/1.1 cache, no matter how |
---|
664 | it is configured, to validate every request, it SHOULD use the "must- |
---|
665 | revalidate" cache-control directive (see Section 16.2). |
---|
666 | |
---|
667 | Servers specify explicit expiration times using either the Expires |
---|
668 | |
---|
669 | |
---|
670 | |
---|
671 | Fielding, et al. Expires December 19, 2008 [Page 12] |
---|
672 | |
---|
673 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
674 | |
---|
675 | |
---|
676 | header, or the max-age directive of the Cache-Control header. |
---|
677 | |
---|
678 | An expiration time cannot be used to force a user agent to refresh |
---|
679 | its display or reload a resource; its semantics apply only to caching |
---|
680 | mechanisms, and such mechanisms need only check a resource's |
---|
681 | expiration status when a new request for that resource is initiated. |
---|
682 | See Section 15 for an explanation of the difference between caches |
---|
683 | and history mechanisms. |
---|
684 | |
---|
685 | 4.2. Heuristic Expiration |
---|
686 | |
---|
687 | Since origin servers do not always provide explicit expiration times, |
---|
688 | HTTP caches typically assign heuristic expiration times, employing |
---|
689 | algorithms that use other header values (such as the Last-Modified |
---|
690 | time) to estimate a plausible expiration time. The HTTP/1.1 |
---|
691 | specification does not provide specific algorithms, but does impose |
---|
692 | worst-case constraints on their results. Since heuristic expiration |
---|
693 | times might compromise semantic transparency, they ought to be used |
---|
694 | cautiously, and we encourage origin servers to provide explicit |
---|
695 | expiration times as much as possible. |
---|
696 | |
---|
697 | 4.3. Age Calculations |
---|
698 | |
---|
699 | In order to know if a cached entry is fresh, a cache needs to know if |
---|
700 | its age exceeds its freshness lifetime. We discuss how to calculate |
---|
701 | the latter in Section 4.4; this section describes how to calculate |
---|
702 | the age of a response or cache entry. |
---|
703 | |
---|
704 | In this discussion, we use the term "now" to mean "the current value |
---|
705 | of the clock at the host performing the calculation." Hosts that use |
---|
706 | HTTP, but especially hosts running origin servers and caches, SHOULD |
---|
707 | use NTP [RFC1305] or some similar protocol to synchronize their |
---|
708 | clocks to a globally accurate time standard. |
---|
709 | |
---|
710 | HTTP/1.1 requires origin servers to send a Date header, if possible, |
---|
711 | with every response, giving the time at which the response was |
---|
712 | generated (see Section 8.3 of [Part1]). We use the term "date_value" |
---|
713 | to denote the value of the Date header, in a form appropriate for |
---|
714 | arithmetic operations. |
---|
715 | |
---|
716 | HTTP/1.1 uses the Age response-header to convey the estimated age of |
---|
717 | the response message when obtained from a cache. The Age field value |
---|
718 | is the cache's estimate of the amount of time since the response was |
---|
719 | generated or revalidated by the origin server. |
---|
720 | |
---|
721 | In essence, the Age value is the sum of the time that the response |
---|
722 | has been resident in each of the caches along the path from the |
---|
723 | origin server, plus the amount of time it has been in transit along |
---|
724 | |
---|
725 | |
---|
726 | |
---|
727 | Fielding, et al. Expires December 19, 2008 [Page 13] |
---|
728 | |
---|
729 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
730 | |
---|
731 | |
---|
732 | network paths. |
---|
733 | |
---|
734 | We use the term "age_value" to denote the value of the Age header, in |
---|
735 | a form appropriate for arithmetic operations. |
---|
736 | |
---|
737 | A response's age can be calculated in two entirely independent ways: |
---|
738 | |
---|
739 | 1. now minus date_value, if the local clock is reasonably well |
---|
740 | synchronized to the origin server's clock. If the result is |
---|
741 | negative, the result is replaced by zero. |
---|
742 | |
---|
743 | 2. age_value, if all of the caches along the response path implement |
---|
744 | HTTP/1.1. |
---|
745 | |
---|
746 | Given that we have two independent ways to compute the age of a |
---|
747 | response when it is received, we can combine these as |
---|
748 | |
---|
749 | corrected_received_age = max(now - date_value, age_value) |
---|
750 | |
---|
751 | and as long as we have either nearly synchronized clocks or all- |
---|
752 | HTTP/1.1 paths, one gets a reliable (conservative) result. |
---|
753 | |
---|
754 | Because of network-imposed delays, some significant interval might |
---|
755 | pass between the time that a server generates a response and the time |
---|
756 | it is received at the next outbound cache or client. If uncorrected, |
---|
757 | this delay could result in improperly low ages. |
---|
758 | |
---|
759 | Because the request that resulted in the returned Age value must have |
---|
760 | been initiated prior to that Age value's generation, we can correct |
---|
761 | for delays imposed by the network by recording the time at which the |
---|
762 | request was initiated. Then, when an Age value is received, it MUST |
---|
763 | be interpreted relative to the time the request was initiated, not |
---|
764 | the time that the response was received. This algorithm results in |
---|
765 | conservative behavior no matter how much delay is experienced. So, |
---|
766 | we compute: |
---|
767 | |
---|
768 | corrected_initial_age = corrected_received_age |
---|
769 | + (now - request_time) |
---|
770 | |
---|
771 | where "request_time" is the time (according to the local clock) when |
---|
772 | the request that elicited this response was sent. |
---|
773 | |
---|
774 | Summary of age calculation algorithm, when a cache receives a |
---|
775 | response: |
---|
776 | |
---|
777 | |
---|
778 | |
---|
779 | |
---|
780 | |
---|
781 | |
---|
782 | |
---|
783 | Fielding, et al. Expires December 19, 2008 [Page 14] |
---|
784 | |
---|
785 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
786 | |
---|
787 | |
---|
788 | /* |
---|
789 | * age_value |
---|
790 | * is the value of Age: header received by the cache with |
---|
791 | * this response. |
---|
792 | * date_value |
---|
793 | * is the value of the origin server's Date: header |
---|
794 | * request_time |
---|
795 | * is the (local) time when the cache made the request |
---|
796 | * that resulted in this cached response |
---|
797 | * response_time |
---|
798 | * is the (local) time when the cache received the |
---|
799 | * response |
---|
800 | * now |
---|
801 | * is the current (local) time |
---|
802 | */ |
---|
803 | |
---|
804 | apparent_age = max(0, response_time - date_value); |
---|
805 | corrected_received_age = max(apparent_age, age_value); |
---|
806 | response_delay = response_time - request_time; |
---|
807 | corrected_initial_age = corrected_received_age + response_delay; |
---|
808 | resident_time = now - response_time; |
---|
809 | current_age = corrected_initial_age + resident_time; |
---|
810 | |
---|
811 | The current_age of a cache entry is calculated by adding the amount |
---|
812 | of time (in seconds) since the cache entry was last validated by the |
---|
813 | origin server to the corrected_initial_age. When a response is |
---|
814 | generated from a cache entry, the cache MUST include a single Age |
---|
815 | header field in the response with a value equal to the cache entry's |
---|
816 | current_age. |
---|
817 | |
---|
818 | The presence of an Age header field in a response implies that a |
---|
819 | response is not first-hand. However, the converse is not true, since |
---|
820 | the lack of an Age header field in a response does not imply that the |
---|
821 | response is first-hand unless all caches along the request path are |
---|
822 | compliant with HTTP/1.1 (i.e., older HTTP caches did not implement |
---|
823 | the Age header field). |
---|
824 | |
---|
825 | 4.4. Expiration Calculations |
---|
826 | |
---|
827 | In order to decide whether a response is fresh or stale, we need to |
---|
828 | compare its freshness lifetime to its age. The age is calculated as |
---|
829 | described in Section 4.3; this section describes how to calculate the |
---|
830 | freshness lifetime, and to determine if a response has expired. In |
---|
831 | the discussion below, the values can be represented in any form |
---|
832 | appropriate for arithmetic operations. |
---|
833 | |
---|
834 | We use the term "expires_value" to denote the value of the Expires |
---|
835 | header. We use the term "max_age_value" to denote an appropriate |
---|
836 | |
---|
837 | |
---|
838 | |
---|
839 | Fielding, et al. Expires December 19, 2008 [Page 15] |
---|
840 | |
---|
841 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
842 | |
---|
843 | |
---|
844 | value of the number of seconds carried by the "max-age" directive of |
---|
845 | the Cache-Control header in a response (see Section 16.2.3). |
---|
846 | |
---|
847 | The max-age directive takes priority over Expires, so if max-age is |
---|
848 | present in a response, the calculation is simply: |
---|
849 | |
---|
850 | freshness_lifetime = max_age_value |
---|
851 | |
---|
852 | Otherwise, if Expires is present in the response, the calculation is: |
---|
853 | |
---|
854 | freshness_lifetime = expires_value - date_value |
---|
855 | |
---|
856 | Note that neither of these calculations is vulnerable to clock skew, |
---|
857 | since all of the information comes from the origin server. |
---|
858 | |
---|
859 | If none of Expires, Cache-Control: max-age, or Cache-Control: |
---|
860 | s-maxage (see Section 16.2.3) appears in the response, and the |
---|
861 | response does not include other restrictions on caching, the cache |
---|
862 | MAY compute a freshness lifetime using a heuristic. The cache MUST |
---|
863 | attach Warning 113 to any response whose age is more than 24 hours if |
---|
864 | such warning has not already been added. |
---|
865 | |
---|
866 | Also, if the response does have a Last-Modified time, the heuristic |
---|
867 | expiration value SHOULD be no more than some fraction of the interval |
---|
868 | since that time. A typical setting of this fraction might be 10%. |
---|
869 | |
---|
870 | The calculation to determine if a response has expired is quite |
---|
871 | simple: |
---|
872 | |
---|
873 | response_is_fresh = (freshness_lifetime > current_age) |
---|
874 | |
---|
875 | 4.5. Disambiguating Expiration Values |
---|
876 | |
---|
877 | Because expiration values are assigned optimistically, it is possible |
---|
878 | for two caches to contain fresh values for the same resource that are |
---|
879 | different. |
---|
880 | |
---|
881 | If a client performing a retrieval receives a non-first-hand response |
---|
882 | for a request that was already fresh in its own cache, and the Date |
---|
883 | header in its existing cache entry is newer than the Date on the new |
---|
884 | response, then the client MAY ignore the response. If so, it MAY |
---|
885 | retry the request with a "Cache-Control: max-age=0" directive (see |
---|
886 | Section 16.2), to force a check with the origin server. |
---|
887 | |
---|
888 | If a cache has two fresh responses for the same representation with |
---|
889 | different validators, it MUST use the one with the more recent Date |
---|
890 | header. This situation might arise because the cache is pooling |
---|
891 | responses from other caches, or because a client has asked for a |
---|
892 | |
---|
893 | |
---|
894 | |
---|
895 | Fielding, et al. Expires December 19, 2008 [Page 16] |
---|
896 | |
---|
897 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
898 | |
---|
899 | |
---|
900 | reload or a revalidation of an apparently fresh cache entry. |
---|
901 | |
---|
902 | 4.6. Disambiguating Multiple Responses |
---|
903 | |
---|
904 | Because a client might be receiving responses via multiple paths, so |
---|
905 | that some responses flow through one set of caches and other |
---|
906 | responses flow through a different set of caches, a client might |
---|
907 | receive responses in an order different from that in which the origin |
---|
908 | server sent them. We would like the client to use the most recently |
---|
909 | generated response, even if older responses are still apparently |
---|
910 | fresh. |
---|
911 | |
---|
912 | Neither the entity tag nor the expiration value can impose an |
---|
913 | ordering on responses, since it is possible that a later response |
---|
914 | intentionally carries an earlier expiration time. The Date values |
---|
915 | are ordered to a granularity of one second. |
---|
916 | |
---|
917 | When a client tries to revalidate a cache entry, and the response it |
---|
918 | receives contains a Date header that appears to be older than the one |
---|
919 | for the existing entry, then the client SHOULD repeat the request |
---|
920 | unconditionally, and include |
---|
921 | |
---|
922 | Cache-Control: max-age=0 |
---|
923 | |
---|
924 | to force any intermediate caches to validate their copies directly |
---|
925 | with the origin server, or |
---|
926 | |
---|
927 | Cache-Control: no-cache |
---|
928 | |
---|
929 | to force any intermediate caches to obtain a new copy from the origin |
---|
930 | server. |
---|
931 | |
---|
932 | If the Date values are equal, then the client MAY use either response |
---|
933 | (or MAY, if it is being extremely prudent, request a new response). |
---|
934 | Servers MUST NOT depend on clients being able to choose |
---|
935 | deterministically between responses generated during the same second, |
---|
936 | if their expiration times overlap. |
---|
937 | |
---|
938 | |
---|
939 | 5. Validation Model |
---|
940 | |
---|
941 | When a cache has a stale entry that it would like to use as a |
---|
942 | response to a client's request, it first has to check with the origin |
---|
943 | server (or possibly an intermediate cache with a fresh response) to |
---|
944 | see if its cached entry is still usable. We call this "validating" |
---|
945 | the cache entry. |
---|
946 | |
---|
947 | HTTP's conditional request mechanism, defined in [Part4], is used to |
---|
948 | |
---|
949 | |
---|
950 | |
---|
951 | Fielding, et al. Expires December 19, 2008 [Page 17] |
---|
952 | |
---|
953 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
954 | |
---|
955 | |
---|
956 | avoid retransmitting the response payload when the cached entry is |
---|
957 | valid. When a cached response includes one or more "cache |
---|
958 | validators," such as the field values of an ETag or Last-Modified |
---|
959 | header field, then a validating GET request SHOULD be made |
---|
960 | conditional to those field values. The server checks the conditional |
---|
961 | request's validator against the current state of the requested |
---|
962 | resource and, if they match, the server responds with a 304 (Not |
---|
963 | Modified) status code to indicate that the cached response can be |
---|
964 | refreshed and reused without retransmitting the response payload. If |
---|
965 | the validator does not match the current state of the requested |
---|
966 | resource, then the server returns a full response, including payload, |
---|
967 | so that the request can be satisfied and the cache entry supplanted |
---|
968 | without the need for an additional network round-trip. |
---|
969 | |
---|
970 | |
---|
971 | 6. Response Cacheability |
---|
972 | |
---|
973 | Unless specifically constrained by a cache-control (Section 16.2) |
---|
974 | directive, a caching system MAY always store a successful response |
---|
975 | (see Section 10) as a cache entry, MAY return it without validation |
---|
976 | if it is fresh, and MAY return it after successful validation. If |
---|
977 | there is neither a cache validator nor an explicit expiration time |
---|
978 | associated with a response, we do not expect it to be cached, but |
---|
979 | certain caches MAY violate this expectation (for example, when little |
---|
980 | or no network connectivity is available). A client can usually |
---|
981 | detect that such a response was taken from a cache by comparing the |
---|
982 | Date header to the current time. |
---|
983 | |
---|
984 | Note: some HTTP/1.0 caches are known to violate this expectation |
---|
985 | without providing any Warning. |
---|
986 | |
---|
987 | However, in some cases it might be inappropriate for a cache to |
---|
988 | retain an entity, or to return it in response to a subsequent |
---|
989 | request. This might be because absolute semantic transparency is |
---|
990 | deemed necessary by the service author, or because of security or |
---|
991 | privacy considerations. Certain cache-control directives are |
---|
992 | therefore provided so that the server can indicate that certain |
---|
993 | resource entities, or portions thereof, are not to be cached |
---|
994 | regardless of other considerations. |
---|
995 | |
---|
996 | Note that Section 4.1 of [Part7] normally prevents a shared cache |
---|
997 | from saving and returning a response to a previous request if that |
---|
998 | request included an Authorization header. |
---|
999 | |
---|
1000 | A response received with a status code of 200, 203, 206, 300, 301 or |
---|
1001 | 410 MAY be stored by a cache and used in reply to a subsequent |
---|
1002 | request, subject to the expiration mechanism, unless a cache-control |
---|
1003 | directive prohibits caching. However, a cache that does not support |
---|
1004 | |
---|
1005 | |
---|
1006 | |
---|
1007 | Fielding, et al. Expires December 19, 2008 [Page 18] |
---|
1008 | |
---|
1009 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1010 | |
---|
1011 | |
---|
1012 | the Range and Content-Range headers MUST NOT cache 206 (Partial |
---|
1013 | Content) responses. |
---|
1014 | |
---|
1015 | A response received with any other status code (e.g. status codes 302 |
---|
1016 | and 307) MUST NOT be returned in a reply to a subsequent request |
---|
1017 | unless there are cache-control directives or another header(s) that |
---|
1018 | explicitly allow it. For example, these include the following: an |
---|
1019 | Expires header (Section 16.3); a "max-age", "s-maxage", "must- |
---|
1020 | revalidate", "proxy-revalidate", "public" or "private" cache-control |
---|
1021 | directive (Section 16.2). |
---|
1022 | |
---|
1023 | |
---|
1024 | 7. Constructing Responses From Caches |
---|
1025 | |
---|
1026 | The purpose of an HTTP cache is to store information received in |
---|
1027 | response to requests for use in responding to future requests. In |
---|
1028 | many cases, a cache simply returns the appropriate parts of a |
---|
1029 | response to the requester. However, if the cache holds a cache entry |
---|
1030 | based on a previous response, it might have to combine parts of a new |
---|
1031 | response with what is held in the cache entry. |
---|
1032 | |
---|
1033 | 7.1. End-to-end and Hop-by-hop Headers |
---|
1034 | |
---|
1035 | For the purpose of defining the behavior of caches and non-caching |
---|
1036 | proxies, we divide HTTP headers into two categories: |
---|
1037 | |
---|
1038 | o End-to-end headers, which are transmitted to the ultimate |
---|
1039 | recipient of a request or response. End-to-end headers in |
---|
1040 | responses MUST be stored as part of a cache entry and MUST be |
---|
1041 | transmitted in any response formed from a cache entry. |
---|
1042 | |
---|
1043 | o Hop-by-hop headers, which are meaningful only for a single |
---|
1044 | transport-level connection, and are not stored by caches or |
---|
1045 | forwarded by proxies. |
---|
1046 | |
---|
1047 | The following HTTP/1.1 headers are hop-by-hop headers: |
---|
1048 | |
---|
1049 | o Connection |
---|
1050 | |
---|
1051 | o Keep-Alive |
---|
1052 | |
---|
1053 | o Proxy-Authenticate |
---|
1054 | |
---|
1055 | o Proxy-Authorization |
---|
1056 | |
---|
1057 | o TE |
---|
1058 | |
---|
1059 | |
---|
1060 | |
---|
1061 | |
---|
1062 | |
---|
1063 | Fielding, et al. Expires December 19, 2008 [Page 19] |
---|
1064 | |
---|
1065 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1066 | |
---|
1067 | |
---|
1068 | o Trailer |
---|
1069 | |
---|
1070 | o Transfer-Encoding |
---|
1071 | |
---|
1072 | o Upgrade |
---|
1073 | |
---|
1074 | All other headers defined by HTTP/1.1 are end-to-end headers. |
---|
1075 | |
---|
1076 | Other hop-by-hop headers MUST be listed in a Connection header |
---|
1077 | (Section 8.1 of [Part1]). |
---|
1078 | |
---|
1079 | 7.2. Non-modifiable Headers |
---|
1080 | |
---|
1081 | Some features of HTTP/1.1, such as Digest Authentication, depend on |
---|
1082 | the value of certain end-to-end headers. A transparent proxy SHOULD |
---|
1083 | NOT modify an end-to-end header unless the definition of that header |
---|
1084 | requires or specifically allows that. |
---|
1085 | |
---|
1086 | A transparent proxy MUST NOT modify any of the following fields in a |
---|
1087 | request or response, and it MUST NOT add any of these fields if not |
---|
1088 | already present: |
---|
1089 | |
---|
1090 | o Content-Location |
---|
1091 | |
---|
1092 | o Content-MD5 |
---|
1093 | |
---|
1094 | o ETag |
---|
1095 | |
---|
1096 | o Last-Modified |
---|
1097 | |
---|
1098 | A transparent proxy MUST NOT modify any of the following fields in a |
---|
1099 | response: |
---|
1100 | |
---|
1101 | o Expires |
---|
1102 | |
---|
1103 | but it MAY add any of these fields if not already present. If an |
---|
1104 | Expires header is added, it MUST be given a field-value identical to |
---|
1105 | that of the Date header in that response. |
---|
1106 | |
---|
1107 | A proxy MUST NOT modify or add any of the following fields in a |
---|
1108 | message that contains the no-transform cache-control directive, or in |
---|
1109 | any request: |
---|
1110 | |
---|
1111 | o Content-Encoding |
---|
1112 | |
---|
1113 | o Content-Range |
---|
1114 | |
---|
1115 | |
---|
1116 | |
---|
1117 | |
---|
1118 | |
---|
1119 | Fielding, et al. Expires December 19, 2008 [Page 20] |
---|
1120 | |
---|
1121 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1122 | |
---|
1123 | |
---|
1124 | o Content-Type |
---|
1125 | |
---|
1126 | A non-transparent proxy MAY modify or add these fields to a message |
---|
1127 | that does not include no-transform, but if it does so, it MUST add a |
---|
1128 | Warning 214 (Transformation applied) if one does not already appear |
---|
1129 | in the message (see Section 16.6). |
---|
1130 | |
---|
1131 | Warning: unnecessary modification of end-to-end headers might |
---|
1132 | cause authentication failures if stronger authentication |
---|
1133 | mechanisms are introduced in later versions of HTTP. Such |
---|
1134 | authentication mechanisms MAY rely on the values of header fields |
---|
1135 | not listed here. |
---|
1136 | |
---|
1137 | The Content-Length field of a request or response is added or deleted |
---|
1138 | according to the rules in Section 4.4 of [Part1]. A transparent |
---|
1139 | proxy MUST preserve the entity-length (Section 4.2.2 of [Part3]) of |
---|
1140 | the entity-body, although it MAY change the transfer-length (Section |
---|
1141 | 4.4 of [Part1]). |
---|
1142 | |
---|
1143 | 7.3. Combining Headers |
---|
1144 | |
---|
1145 | When a cache makes a validating request to a server, and the server |
---|
1146 | provides a 304 (Not Modified) response or a 206 (Partial Content) |
---|
1147 | response, the cache then constructs a response to send to the |
---|
1148 | requesting client. |
---|
1149 | |
---|
1150 | If the status code is 304 (Not Modified), the cache uses the entity- |
---|
1151 | body stored in the cache entry as the entity-body of this outgoing |
---|
1152 | response. If the status code is 206 (Partial Content) and the ETag |
---|
1153 | or Last-Modified headers match exactly, the cache MAY combine the |
---|
1154 | contents stored in the cache entry with the new contents received in |
---|
1155 | the response and use the result as the entity-body of this outgoing |
---|
1156 | response, (see Section 5 of [Part5]). |
---|
1157 | |
---|
1158 | The end-to-end headers stored in the cache entry are used for the |
---|
1159 | constructed response, except that |
---|
1160 | |
---|
1161 | o any stored Warning headers with warn-code 1xx (see Section 16.6) |
---|
1162 | MUST be deleted from the cache entry and the forwarded response. |
---|
1163 | |
---|
1164 | o any stored Warning headers with warn-code 2xx MUST be retained in |
---|
1165 | the cache entry and the forwarded response. |
---|
1166 | |
---|
1167 | o any end-to-end headers provided in the 304 or 206 response MUST |
---|
1168 | replace the corresponding headers from the cache entry. |
---|
1169 | |
---|
1170 | Unless the cache decides to remove the cache entry, it MUST also |
---|
1171 | replace the end-to-end headers stored with the cache entry with |
---|
1172 | |
---|
1173 | |
---|
1174 | |
---|
1175 | Fielding, et al. Expires December 19, 2008 [Page 21] |
---|
1176 | |
---|
1177 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1178 | |
---|
1179 | |
---|
1180 | corresponding headers received in the incoming response, except for |
---|
1181 | Warning headers as described immediately above. If a header field- |
---|
1182 | name in the incoming response matches more than one header in the |
---|
1183 | cache entry, all such old headers MUST be replaced. |
---|
1184 | |
---|
1185 | In other words, the set of end-to-end headers received in the |
---|
1186 | incoming response overrides all corresponding end-to-end headers |
---|
1187 | stored with the cache entry (except for stored Warning headers with |
---|
1188 | warn-code 1xx, which are deleted even if not overridden). |
---|
1189 | |
---|
1190 | Note: this rule allows an origin server to use a 304 (Not |
---|
1191 | Modified) or a 206 (Partial Content) response to update any header |
---|
1192 | associated with a previous response for the same entity or sub- |
---|
1193 | ranges thereof, although it might not always be meaningful or |
---|
1194 | correct to do so. This rule does not allow an origin server to |
---|
1195 | use a 304 (Not Modified) or a 206 (Partial Content) response to |
---|
1196 | entirely delete a header that it had provided with a previous |
---|
1197 | response. |
---|
1198 | |
---|
1199 | |
---|
1200 | 8. Caching Negotiated Responses |
---|
1201 | |
---|
1202 | Use of server-driven content negotiation (Section 5.1 of [Part3]), as |
---|
1203 | indicated by the presence of a Vary header field in a response, |
---|
1204 | alters the conditions and procedure by which a cache can use the |
---|
1205 | response for subsequent requests. See Section 16.5 for use of the |
---|
1206 | Vary header field by servers. |
---|
1207 | |
---|
1208 | A server SHOULD use the Vary header field to inform a cache of what |
---|
1209 | request-header fields were used to select among multiple |
---|
1210 | representations of a cacheable response subject to server-driven |
---|
1211 | negotiation. The set of header fields named by the Vary field value |
---|
1212 | is known as the "selecting" request-headers. |
---|
1213 | |
---|
1214 | When the cache receives a subsequent request whose Request-URI |
---|
1215 | specifies one or more cache entries including a Vary header field, |
---|
1216 | the cache MUST NOT use such a cache entry to construct a response to |
---|
1217 | the new request unless all of the selecting request-headers present |
---|
1218 | in the new request match the corresponding stored request-headers in |
---|
1219 | the original request. |
---|
1220 | |
---|
1221 | The selecting request-headers from two requests are defined to match |
---|
1222 | if and only if the selecting request-headers in the first request can |
---|
1223 | be transformed to the selecting request-headers in the second request |
---|
1224 | by adding or removing linear white space (LWS) at places where this |
---|
1225 | is allowed by the corresponding BNF, and/or combining multiple |
---|
1226 | message-header fields with the same field name following the rules |
---|
1227 | about message headers in Section 4.2 of [Part1]. |
---|
1228 | |
---|
1229 | |
---|
1230 | |
---|
1231 | Fielding, et al. Expires December 19, 2008 [Page 22] |
---|
1232 | |
---|
1233 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1234 | |
---|
1235 | |
---|
1236 | A Vary header field-value of "*" always fails to match and subsequent |
---|
1237 | requests on that resource can only be properly interpreted by the |
---|
1238 | origin server. |
---|
1239 | |
---|
1240 | If the selecting request header fields for the cached entry do not |
---|
1241 | match the selecting request header fields of the new request, then |
---|
1242 | the cache MUST NOT use a cached entry to satisfy the request unless |
---|
1243 | it first relays the new request to the origin server in a conditional |
---|
1244 | request and the server responds with 304 (Not Modified), including an |
---|
1245 | entity tag or Content-Location that indicates the entity to be used. |
---|
1246 | |
---|
1247 | If an entity tag was assigned to a cached representation, the |
---|
1248 | forwarded request SHOULD be conditional and include the entity tags |
---|
1249 | in an If-None-Match header field from all its cache entries for the |
---|
1250 | resource. This conveys to the server the set of entities currently |
---|
1251 | held by the cache, so that if any one of these entities matches the |
---|
1252 | requested entity, the server can use the ETag header field in its 304 |
---|
1253 | (Not Modified) response to tell the cache which entry is appropriate. |
---|
1254 | If the entity-tag of the new response matches that of an existing |
---|
1255 | entry, the new response SHOULD be used to update the header fields of |
---|
1256 | the existing entry, and the result MUST be returned to the client. |
---|
1257 | |
---|
1258 | If any of the existing cache entries contains only partial content |
---|
1259 | for the associated entity, its entity-tag SHOULD NOT be included in |
---|
1260 | the If-None-Match header field unless the request is for a range that |
---|
1261 | would be fully satisfied by that entry. |
---|
1262 | |
---|
1263 | If a cache receives a successful response whose Content-Location |
---|
1264 | field matches that of an existing cache entry for the same Request- |
---|
1265 | URI, whose entity-tag differs from that of the existing entry, and |
---|
1266 | whose Date is more recent than that of the existing entry, the |
---|
1267 | existing entry SHOULD NOT be returned in response to future requests |
---|
1268 | and SHOULD be deleted from the cache. |
---|
1269 | |
---|
1270 | |
---|
1271 | 9. Shared and Non-Shared Caches |
---|
1272 | |
---|
1273 | For reasons of security and privacy, it is necessary to make a |
---|
1274 | distinction between "shared" and "non-shared" caches. A non-shared |
---|
1275 | cache is one that is accessible only to a single user. Accessibility |
---|
1276 | in this case SHOULD be enforced by appropriate security mechanisms. |
---|
1277 | All other caches are considered to be "shared." Other sections of |
---|
1278 | this specification place certain constraints on the operation of |
---|
1279 | shared caches in order to prevent loss of privacy or failure of |
---|
1280 | access controls. |
---|
1281 | |
---|
1282 | |
---|
1283 | |
---|
1284 | |
---|
1285 | |
---|
1286 | |
---|
1287 | Fielding, et al. Expires December 19, 2008 [Page 23] |
---|
1288 | |
---|
1289 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1290 | |
---|
1291 | |
---|
1292 | 10. Errors or Incomplete Response Cache Behavior |
---|
1293 | |
---|
1294 | A cache that receives an incomplete response (for example, with fewer |
---|
1295 | bytes of data than specified in a Content-Length header) MAY store |
---|
1296 | the response. However, the cache MUST treat this as a partial |
---|
1297 | response. Partial responses MAY be combined as described in Section |
---|
1298 | 5 of [Part5]; the result might be a full response or might still be |
---|
1299 | partial. A cache MUST NOT return a partial response to a client |
---|
1300 | without explicitly marking it as such, using the 206 (Partial |
---|
1301 | Content) status code. A cache MUST NOT return a partial response |
---|
1302 | using a status code of 200 (OK). |
---|
1303 | |
---|
1304 | If a cache receives a 5xx response while attempting to revalidate an |
---|
1305 | entry, it MAY either forward this response to the requesting client, |
---|
1306 | or act as if the server failed to respond. In the latter case, it |
---|
1307 | MAY return a previously received response unless the cached entry |
---|
1308 | includes the "must-revalidate" cache-control directive (see |
---|
1309 | Section 16.2). |
---|
1310 | |
---|
1311 | |
---|
1312 | 11. Side Effects of GET and HEAD |
---|
1313 | |
---|
1314 | Unless the origin server explicitly prohibits the caching of their |
---|
1315 | responses, the application of GET and HEAD methods to any resources |
---|
1316 | SHOULD NOT have side effects that would lead to erroneous behavior if |
---|
1317 | these responses are taken from a cache. They MAY still have side |
---|
1318 | effects, but a cache is not required to consider such side effects in |
---|
1319 | its caching decisions. Caches are always expected to observe an |
---|
1320 | origin server's explicit restrictions on caching. |
---|
1321 | |
---|
1322 | We note one exception to this rule: since some applications have |
---|
1323 | traditionally used GET and HEAD requests with URLs containing a query |
---|
1324 | part to perform operations with significant side effects, caches MUST |
---|
1325 | NOT treat responses to such URIs as fresh unless the server provides |
---|
1326 | an explicit expiration time. This specifically means that responses |
---|
1327 | from HTTP/1.0 servers for such URIs SHOULD NOT be taken from a cache. |
---|
1328 | See Section 8.1.1 of [Part2] for related information. |
---|
1329 | |
---|
1330 | |
---|
1331 | 12. Invalidation After Updates or Deletions |
---|
1332 | |
---|
1333 | The effect of certain methods performed on a resource at the origin |
---|
1334 | server might cause one or more existing cache entries to become non- |
---|
1335 | transparently invalid. That is, although they might continue to be |
---|
1336 | "fresh," they do not accurately reflect what the origin server would |
---|
1337 | return for a new request on that resource. |
---|
1338 | |
---|
1339 | There is no way for HTTP to guarantee that all such cache entries are |
---|
1340 | |
---|
1341 | |
---|
1342 | |
---|
1343 | Fielding, et al. Expires December 19, 2008 [Page 24] |
---|
1344 | |
---|
1345 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1346 | |
---|
1347 | |
---|
1348 | marked invalid. For example, the request that caused the change at |
---|
1349 | the origin server might not have gone through the proxy where a cache |
---|
1350 | entry is stored. However, several rules help reduce the likelihood |
---|
1351 | of erroneous behavior. |
---|
1352 | |
---|
1353 | In this section, the phrase "invalidate an entity" means that the |
---|
1354 | cache will either remove all instances of that entity from its |
---|
1355 | storage, or will mark these as "invalid" and in need of a mandatory |
---|
1356 | revalidation before they can be returned in response to a subsequent |
---|
1357 | request. |
---|
1358 | |
---|
1359 | Some HTTP methods MUST cause a cache to invalidate an entity. This |
---|
1360 | is either the entity referred to by the Request-URI, or by the |
---|
1361 | Location or Content-Location headers (if present). These methods |
---|
1362 | are: |
---|
1363 | |
---|
1364 | o PUT |
---|
1365 | |
---|
1366 | o DELETE |
---|
1367 | |
---|
1368 | o POST |
---|
1369 | |
---|
1370 | An invalidation based on the URI in a Location or Content-Location |
---|
1371 | header MUST NOT be performed if the host part of that URI differs |
---|
1372 | from the host part in the Request-URI. This helps prevent denial of |
---|
1373 | service attacks. |
---|
1374 | |
---|
1375 | A cache that passes through requests for methods it does not |
---|
1376 | understand SHOULD invalidate any entities referred to by the Request- |
---|
1377 | URI. |
---|
1378 | |
---|
1379 | |
---|
1380 | 13. Write-Through Mandatory |
---|
1381 | |
---|
1382 | All methods that might be expected to cause modifications to the |
---|
1383 | origin server's resources MUST be written through to the origin |
---|
1384 | server. This currently includes all methods except for GET and HEAD. |
---|
1385 | A cache MUST NOT reply to such a request from a client before having |
---|
1386 | transmitted the request to the inbound server, and having received a |
---|
1387 | corresponding response from the inbound server. This does not |
---|
1388 | prevent a proxy cache from sending a 100 (Continue) response before |
---|
1389 | the inbound server has sent its final reply. |
---|
1390 | |
---|
1391 | The alternative (known as "write-back" or "copy-back" caching) is not |
---|
1392 | allowed in HTTP/1.1, due to the difficulty of providing consistent |
---|
1393 | updates and the problems arising from server, cache, or network |
---|
1394 | failure prior to write-back. |
---|
1395 | |
---|
1396 | |
---|
1397 | |
---|
1398 | |
---|
1399 | Fielding, et al. Expires December 19, 2008 [Page 25] |
---|
1400 | |
---|
1401 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1402 | |
---|
1403 | |
---|
1404 | 14. Cache Replacement |
---|
1405 | |
---|
1406 | If a new cacheable (see Sections 16.2.2, 4.5, 4.6 and 10) response is |
---|
1407 | received from a resource while any existing responses for the same |
---|
1408 | resource are cached, the cache SHOULD use the new response to reply |
---|
1409 | to the current request. It MAY insert it into cache storage and MAY, |
---|
1410 | if it meets all other requirements, use it to respond to any future |
---|
1411 | requests that would previously have caused the old response to be |
---|
1412 | returned. If it inserts the new response into cache storage the |
---|
1413 | rules in Section 7.3 apply. |
---|
1414 | |
---|
1415 | Note: a new response that has an older Date header value than |
---|
1416 | existing cached responses is not cacheable. |
---|
1417 | |
---|
1418 | |
---|
1419 | 15. History Lists |
---|
1420 | |
---|
1421 | User agents often have history mechanisms, such as "Back" buttons and |
---|
1422 | history lists, which can be used to redisplay an entity retrieved |
---|
1423 | earlier in a session. |
---|
1424 | |
---|
1425 | History mechanisms and caches are different. In particular history |
---|
1426 | mechanisms SHOULD NOT try to show a semantically transparent view of |
---|
1427 | the current state of a resource. Rather, a history mechanism is |
---|
1428 | meant to show exactly what the user saw at the time when the resource |
---|
1429 | was retrieved. |
---|
1430 | |
---|
1431 | By default, an expiration time does not apply to history mechanisms. |
---|
1432 | If the entity is still in storage, a history mechanism SHOULD display |
---|
1433 | it even if the entity has expired, unless the user has specifically |
---|
1434 | configured the agent to refresh expired history documents. |
---|
1435 | |
---|
1436 | This is not to be construed to prohibit the history mechanism from |
---|
1437 | telling the user that a view might be stale. |
---|
1438 | |
---|
1439 | Note: if history list mechanisms unnecessarily prevent users from |
---|
1440 | viewing stale resources, this will tend to force service authors |
---|
1441 | to avoid using HTTP expiration controls and cache controls when |
---|
1442 | they would otherwise like to. Service authors may consider it |
---|
1443 | important that users not be presented with error messages or |
---|
1444 | warning messages when they use navigation controls (such as BACK) |
---|
1445 | to view previously fetched resources. Even though sometimes such |
---|
1446 | resources ought not be cached, or ought to expire quickly, user |
---|
1447 | interface considerations may force service authors to resort to |
---|
1448 | other means of preventing caching (e.g. "once-only" URLs) in order |
---|
1449 | not to suffer the effects of improperly functioning history |
---|
1450 | mechanisms. |
---|
1451 | |
---|
1452 | |
---|
1453 | |
---|
1454 | |
---|
1455 | Fielding, et al. Expires December 19, 2008 [Page 26] |
---|
1456 | |
---|
1457 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1458 | |
---|
1459 | |
---|
1460 | 16. Header Field Definitions |
---|
1461 | |
---|
1462 | This section defines the syntax and semantics of HTTP/1.1 header |
---|
1463 | fields related to caching. |
---|
1464 | |
---|
1465 | For entity-header fields, both sender and recipient refer to either |
---|
1466 | the client or the server, depending on who sends and who receives the |
---|
1467 | entity. |
---|
1468 | |
---|
1469 | 16.1. Age |
---|
1470 | |
---|
1471 | The Age response-header field conveys the sender's estimate of the |
---|
1472 | amount of time since the response (or its revalidation) was generated |
---|
1473 | at the origin server. A cached response is "fresh" if its age does |
---|
1474 | not exceed its freshness lifetime. Age values are calculated as |
---|
1475 | specified in Section 4.3. |
---|
1476 | |
---|
1477 | Age = "Age" ":" age-value |
---|
1478 | age-value = delta-seconds |
---|
1479 | |
---|
1480 | Age values are non-negative decimal integers, representing time in |
---|
1481 | seconds. |
---|
1482 | |
---|
1483 | delta-seconds = 1*DIGIT |
---|
1484 | |
---|
1485 | If a cache receives a value larger than the largest positive integer |
---|
1486 | it can represent, or if any of its age calculations overflows, it |
---|
1487 | MUST transmit an Age header with a value of 2147483648 (2^31). An |
---|
1488 | HTTP/1.1 server that includes a cache MUST include an Age header |
---|
1489 | field in every response generated from its own cache. Caches SHOULD |
---|
1490 | use an arithmetic type of at least 31 bits of range. |
---|
1491 | |
---|
1492 | 16.2. Cache-Control |
---|
1493 | |
---|
1494 | The Cache-Control general-header field is used to specify directives |
---|
1495 | that MUST be obeyed by all caching mechanisms along the request/ |
---|
1496 | response chain. The directives specify behavior intended to prevent |
---|
1497 | caches from adversely interfering with the request or response. |
---|
1498 | These directives typically override the default caching algorithms. |
---|
1499 | Cache directives are unidirectional in that the presence of a |
---|
1500 | directive in a request does not imply that the same directive is to |
---|
1501 | be given in the response. |
---|
1502 | |
---|
1503 | Note that HTTP/1.0 caches might not implement Cache-Control and |
---|
1504 | might only implement Pragma: no-cache (see Section 16.4). |
---|
1505 | |
---|
1506 | Cache directives MUST be passed through by a proxy or gateway |
---|
1507 | application, regardless of their significance to that application, |
---|
1508 | |
---|
1509 | |
---|
1510 | |
---|
1511 | Fielding, et al. Expires December 19, 2008 [Page 27] |
---|
1512 | |
---|
1513 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1514 | |
---|
1515 | |
---|
1516 | since the directives might be applicable to all recipients along the |
---|
1517 | request/response chain. It is not possible to specify a cache- |
---|
1518 | directive for a specific cache. |
---|
1519 | |
---|
1520 | Cache-Control = "Cache-Control" ":" 1#cache-directive |
---|
1521 | |
---|
1522 | cache-directive = cache-request-directive |
---|
1523 | | cache-response-directive |
---|
1524 | |
---|
1525 | cache-request-directive = |
---|
1526 | "no-cache" ; Section 16.2.1 |
---|
1527 | | "no-store" ; Section 16.2.2 |
---|
1528 | | "max-age" "=" delta-seconds ; Section 16.2.3, 16.2.4 |
---|
1529 | | "max-stale" [ "=" delta-seconds ] ; Section 16.2.3 |
---|
1530 | | "min-fresh" "=" delta-seconds ; Section 16.2.3 |
---|
1531 | | "no-transform" ; Section 16.2.5 |
---|
1532 | | "only-if-cached" ; Section 16.2.4 |
---|
1533 | | cache-extension ; Section 16.2.6 |
---|
1534 | |
---|
1535 | cache-response-directive = |
---|
1536 | "public" ; Section 16.2.1 |
---|
1537 | | "private" [ "=" DQUOTE 1#field-name DQUOTE ] ; Section 16.2.1 |
---|
1538 | | "no-cache" [ "=" DQUOTE 1#field-name DQUOTE ] ; Section 16.2.1 |
---|
1539 | | "no-store" ; Section 16.2.2 |
---|
1540 | | "no-transform" ; Section 16.2.5 |
---|
1541 | | "must-revalidate" ; Section 16.2.4 |
---|
1542 | | "proxy-revalidate" ; Section 16.2.4 |
---|
1543 | | "max-age" "=" delta-seconds ; Section 16.2.3 |
---|
1544 | | "s-maxage" "=" delta-seconds ; Section 16.2.3 |
---|
1545 | | cache-extension ; Section 16.2.6 |
---|
1546 | |
---|
1547 | cache-extension = token [ "=" ( token | quoted-string ) ] |
---|
1548 | |
---|
1549 | When a directive appears without any 1#field-name parameter, the |
---|
1550 | directive applies to the entire request or response. When such a |
---|
1551 | directive appears with a 1#field-name parameter, it applies only to |
---|
1552 | the named field or fields, and not to the rest of the request or |
---|
1553 | response. This mechanism supports extensibility; implementations of |
---|
1554 | future versions of HTTP might apply these directives to header fields |
---|
1555 | not defined in HTTP/1.1. |
---|
1556 | |
---|
1557 | The cache-control directives can be broken down into these general |
---|
1558 | categories: |
---|
1559 | |
---|
1560 | o Restrictions on what are cacheable; these may only be imposed by |
---|
1561 | the origin server. |
---|
1562 | |
---|
1563 | |
---|
1564 | |
---|
1565 | |
---|
1566 | |
---|
1567 | Fielding, et al. Expires December 19, 2008 [Page 28] |
---|
1568 | |
---|
1569 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1570 | |
---|
1571 | |
---|
1572 | o Restrictions on what may be stored by a cache; these may be |
---|
1573 | imposed by either the origin server or the user agent. |
---|
1574 | |
---|
1575 | o Modifications of the basic expiration mechanism; these may be |
---|
1576 | imposed by either the origin server or the user agent. |
---|
1577 | |
---|
1578 | o Controls over cache revalidation and reload; these may only be |
---|
1579 | imposed by a user agent. |
---|
1580 | |
---|
1581 | o Control over transformation of entities. |
---|
1582 | |
---|
1583 | o Extensions to the caching system. |
---|
1584 | |
---|
1585 | 16.2.1. What is Cacheable |
---|
1586 | |
---|
1587 | By default, a response is cacheable if the requirements of the |
---|
1588 | request method, request header fields, and the response status |
---|
1589 | indicate that it is cacheable. Section 6 summarizes these defaults |
---|
1590 | for cacheability. The following Cache-Control response directives |
---|
1591 | allow an origin server to override the default cacheability of a |
---|
1592 | response: |
---|
1593 | |
---|
1594 | public |
---|
1595 | |
---|
1596 | Indicates that the response MAY be cached by any cache, even if it |
---|
1597 | would normally be non-cacheable or cacheable only within a non- |
---|
1598 | shared cache. (See also Authorization, Section 4.1 of [Part7], |
---|
1599 | for additional details.) |
---|
1600 | |
---|
1601 | private |
---|
1602 | |
---|
1603 | Indicates that all or part of the response message is intended for |
---|
1604 | a single user and MUST NOT be cached by a shared cache. This |
---|
1605 | allows an origin server to state that the specified parts of the |
---|
1606 | response are intended for only one user and are not a valid |
---|
1607 | response for requests by other users. A private (non-shared) |
---|
1608 | cache MAY cache the response. |
---|
1609 | |
---|
1610 | Note: This usage of the word private only controls where the |
---|
1611 | response may be cached, and cannot ensure the privacy of the |
---|
1612 | message content. |
---|
1613 | |
---|
1614 | no-cache |
---|
1615 | |
---|
1616 | If the no-cache directive does not specify a field-name, then a |
---|
1617 | cache MUST NOT use the response to satisfy a subsequent request |
---|
1618 | without successful revalidation with the origin server. This |
---|
1619 | allows an origin server to prevent caching even by caches that |
---|
1620 | |
---|
1621 | |
---|
1622 | |
---|
1623 | Fielding, et al. Expires December 19, 2008 [Page 29] |
---|
1624 | |
---|
1625 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1626 | |
---|
1627 | |
---|
1628 | have been configured to return stale responses to client requests. |
---|
1629 | |
---|
1630 | If the no-cache directive does specify one or more field-names, |
---|
1631 | then a cache MAY use the response to satisfy a subsequent request, |
---|
1632 | subject to any other restrictions on caching. However, the |
---|
1633 | specified field-name(s) MUST NOT be sent in the response to a |
---|
1634 | subsequent request without successful revalidation with the origin |
---|
1635 | server. This allows an origin server to prevent the re-use of |
---|
1636 | certain header fields in a response, while still allowing caching |
---|
1637 | of the rest of the response. |
---|
1638 | |
---|
1639 | Note: Most HTTP/1.0 caches will not recognize or obey this |
---|
1640 | directive. |
---|
1641 | |
---|
1642 | 16.2.2. What May be Stored by Caches |
---|
1643 | |
---|
1644 | no-store |
---|
1645 | |
---|
1646 | The purpose of the no-store directive is to prevent the |
---|
1647 | inadvertent release or retention of sensitive information (for |
---|
1648 | example, on backup tapes). The no-store directive applies to the |
---|
1649 | entire message, and MAY be sent either in a response or in a |
---|
1650 | request. If sent in a request, a cache MUST NOT store any part of |
---|
1651 | either this request or any response to it. If sent in a response, |
---|
1652 | a cache MUST NOT store any part of either this response or the |
---|
1653 | request that elicited it. This directive applies to both non- |
---|
1654 | shared and shared caches. "MUST NOT store" in this context means |
---|
1655 | that the cache MUST NOT intentionally store the information in |
---|
1656 | non-volatile storage, and MUST make a best-effort attempt to |
---|
1657 | remove the information from volatile storage as promptly as |
---|
1658 | possible after forwarding it. |
---|
1659 | |
---|
1660 | Even when this directive is associated with a response, users |
---|
1661 | might explicitly store such a response outside of the caching |
---|
1662 | system (e.g., with a "Save As" dialog). History buffers MAY store |
---|
1663 | such responses as part of their normal operation. |
---|
1664 | |
---|
1665 | The purpose of this directive is to meet the stated requirements |
---|
1666 | of certain users and service authors who are concerned about |
---|
1667 | accidental releases of information via unanticipated accesses to |
---|
1668 | cache data structures. While the use of this directive might |
---|
1669 | improve privacy in some cases, we caution that it is NOT in any |
---|
1670 | way a reliable or sufficient mechanism for ensuring privacy. In |
---|
1671 | particular, malicious or compromised caches might not recognize or |
---|
1672 | obey this directive, and communications networks might be |
---|
1673 | vulnerable to eavesdropping. |
---|
1674 | |
---|
1675 | |
---|
1676 | |
---|
1677 | |
---|
1678 | |
---|
1679 | Fielding, et al. Expires December 19, 2008 [Page 30] |
---|
1680 | |
---|
1681 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1682 | |
---|
1683 | |
---|
1684 | 16.2.3. Modifications of the Basic Expiration Mechanism |
---|
1685 | |
---|
1686 | The expiration time of an entity MAY be specified by the origin |
---|
1687 | server using the Expires header (see Section 16.3). Alternatively, |
---|
1688 | it MAY be specified using the max-age directive in a response. When |
---|
1689 | the max-age cache-control directive is present in a cached response, |
---|
1690 | the response is stale if its current age is greater than the age |
---|
1691 | value given (in seconds) at the time of a new request for that |
---|
1692 | resource. The max-age directive on a response implies that the |
---|
1693 | response is cacheable (i.e., "public") unless some other, more |
---|
1694 | restrictive cache directive is also present. |
---|
1695 | |
---|
1696 | If a response includes both an Expires header and a max-age |
---|
1697 | directive, the max-age directive overrides the Expires header, even |
---|
1698 | if the Expires header is more restrictive. This rule allows an |
---|
1699 | origin server to provide, for a given response, a longer expiration |
---|
1700 | time to an HTTP/1.1 (or later) cache than to an HTTP/1.0 cache. This |
---|
1701 | might be useful if certain HTTP/1.0 caches improperly calculate ages |
---|
1702 | or expiration times, perhaps due to desynchronized clocks. |
---|
1703 | |
---|
1704 | Many HTTP/1.0 cache implementations will treat an Expires value that |
---|
1705 | is less than or equal to the response Date value as being equivalent |
---|
1706 | to the Cache-Control response directive "no-cache". If an HTTP/1.1 |
---|
1707 | cache receives such a response, and the response does not include a |
---|
1708 | Cache-Control header field, it SHOULD consider the response to be |
---|
1709 | non-cacheable in order to retain compatibility with HTTP/1.0 servers. |
---|
1710 | |
---|
1711 | Note: An origin server might wish to use a relatively new HTTP |
---|
1712 | cache control feature, such as the "private" directive, on a |
---|
1713 | network including older caches that do not understand that |
---|
1714 | feature. The origin server will need to combine the new feature |
---|
1715 | with an Expires field whose value is less than or equal to the |
---|
1716 | Date value. This will prevent older caches from improperly |
---|
1717 | caching the response. |
---|
1718 | |
---|
1719 | s-maxage |
---|
1720 | |
---|
1721 | If a response includes an s-maxage directive, then for a shared |
---|
1722 | cache (but not for a private cache), the maximum age specified by |
---|
1723 | this directive overrides the maximum age specified by either the |
---|
1724 | max-age directive or the Expires header. The s-maxage directive |
---|
1725 | also implies the semantics of the proxy-revalidate directive (see |
---|
1726 | Section 16.2.4), i.e., that the shared cache must not use the |
---|
1727 | entry after it becomes stale to respond to a subsequent request |
---|
1728 | without first revalidating it with the origin server. The |
---|
1729 | s-maxage directive is always ignored by a private cache. |
---|
1730 | |
---|
1731 | Note that most older caches, not compliant with this specification, |
---|
1732 | |
---|
1733 | |
---|
1734 | |
---|
1735 | Fielding, et al. Expires December 19, 2008 [Page 31] |
---|
1736 | |
---|
1737 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1738 | |
---|
1739 | |
---|
1740 | do not implement any cache-control directives. An origin server |
---|
1741 | wishing to use a cache-control directive that restricts, but does not |
---|
1742 | prevent, caching by an HTTP/1.1-compliant cache MAY exploit the |
---|
1743 | requirement that the max-age directive overrides the Expires header, |
---|
1744 | and the fact that pre-HTTP/1.1-compliant caches do not observe the |
---|
1745 | max-age directive. |
---|
1746 | |
---|
1747 | Other directives allow a user agent to modify the basic expiration |
---|
1748 | mechanism. These directives MAY be specified on a request: |
---|
1749 | |
---|
1750 | max-age |
---|
1751 | |
---|
1752 | Indicates that the client is willing to accept a response whose |
---|
1753 | age is no greater than the specified time in seconds. Unless max- |
---|
1754 | stale directive is also included, the client is not willing to |
---|
1755 | accept a stale response. |
---|
1756 | |
---|
1757 | min-fresh |
---|
1758 | |
---|
1759 | Indicates that the client is willing to accept a response whose |
---|
1760 | freshness lifetime is no less than its current age plus the |
---|
1761 | specified time in seconds. That is, the client wants a response |
---|
1762 | that will still be fresh for at least the specified number of |
---|
1763 | seconds. |
---|
1764 | |
---|
1765 | max-stale |
---|
1766 | |
---|
1767 | Indicates that the client is willing to accept a response that has |
---|
1768 | exceeded its expiration time. If max-stale is assigned a value, |
---|
1769 | then the client is willing to accept a response that has exceeded |
---|
1770 | its expiration time by no more than the specified number of |
---|
1771 | seconds. If no value is assigned to max-stale, then the client is |
---|
1772 | willing to accept a stale response of any age. |
---|
1773 | |
---|
1774 | If a cache returns a stale response, either because of a max-stale |
---|
1775 | directive on a request, or because the cache is configured to |
---|
1776 | override the expiration time of a response, the cache MUST attach a |
---|
1777 | Warning header to the stale response, using Warning 110 (Response is |
---|
1778 | stale). |
---|
1779 | |
---|
1780 | A cache MAY be configured to return stale responses without |
---|
1781 | validation, but only if this does not conflict with any "MUST"-level |
---|
1782 | requirements concerning cache validation (e.g., a "must-revalidate" |
---|
1783 | cache-control directive). |
---|
1784 | |
---|
1785 | If both the new request and the cached entry include "max-age" |
---|
1786 | directives, then the lesser of the two values is used for determining |
---|
1787 | the freshness of the cached entry for that request. |
---|
1788 | |
---|
1789 | |
---|
1790 | |
---|
1791 | Fielding, et al. Expires December 19, 2008 [Page 32] |
---|
1792 | |
---|
1793 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1794 | |
---|
1795 | |
---|
1796 | 16.2.4. Cache Revalidation and Reload Controls |
---|
1797 | |
---|
1798 | Sometimes a user agent might want or need to insist that a cache |
---|
1799 | revalidate its cache entry with the origin server (and not just with |
---|
1800 | the next cache along the path to the origin server), or to reload its |
---|
1801 | cache entry from the origin server. End-to-end revalidation might be |
---|
1802 | necessary if either the cache or the origin server has overestimated |
---|
1803 | the expiration time of the cached response. End-to-end reload may be |
---|
1804 | necessary if the cache entry has become corrupted for some reason. |
---|
1805 | |
---|
1806 | End-to-end revalidation may be requested either when the client does |
---|
1807 | not have its own local cached copy, in which case we call it |
---|
1808 | "unspecified end-to-end revalidation", or when the client does have a |
---|
1809 | local cached copy, in which case we call it "specific end-to-end |
---|
1810 | revalidation." |
---|
1811 | |
---|
1812 | The client can specify these three kinds of action using Cache- |
---|
1813 | Control request directives: |
---|
1814 | |
---|
1815 | End-to-end reload |
---|
1816 | |
---|
1817 | The request includes a "no-cache" cache-control directive or, for |
---|
1818 | compatibility with HTTP/1.0 clients, "Pragma: no-cache". Field |
---|
1819 | names MUST NOT be included with the no-cache directive in a |
---|
1820 | request. The server MUST NOT use a cached copy when responding to |
---|
1821 | such a request. |
---|
1822 | |
---|
1823 | Specific end-to-end revalidation |
---|
1824 | |
---|
1825 | The request includes a "max-age=0" cache-control directive, which |
---|
1826 | forces each cache along the path to the origin server to |
---|
1827 | revalidate its own entry, if any, with the next cache or server. |
---|
1828 | The initial request includes a cache-validating conditional with |
---|
1829 | the client's current validator. |
---|
1830 | |
---|
1831 | Unspecified end-to-end revalidation |
---|
1832 | |
---|
1833 | The request includes "max-age=0" cache-control directive, which |
---|
1834 | forces each cache along the path to the origin server to |
---|
1835 | revalidate its own entry, if any, with the next cache or server. |
---|
1836 | The initial request does not include a cache-validating |
---|
1837 | conditional; the first cache along the path (if any) that holds a |
---|
1838 | cache entry for this resource includes a cache-validating |
---|
1839 | conditional with its current validator. |
---|
1840 | |
---|
1841 | max-age |
---|
1842 | |
---|
1843 | |
---|
1844 | |
---|
1845 | |
---|
1846 | |
---|
1847 | Fielding, et al. Expires December 19, 2008 [Page 33] |
---|
1848 | |
---|
1849 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1850 | |
---|
1851 | |
---|
1852 | When an intermediate cache is forced, by means of a max-age=0 |
---|
1853 | directive, to revalidate its own cache entry, and the client has |
---|
1854 | supplied its own validator in the request, the supplied validator |
---|
1855 | might differ from the validator currently stored with the cache |
---|
1856 | entry. In this case, the cache MAY use either validator in making |
---|
1857 | its own request without affecting semantic transparency. |
---|
1858 | |
---|
1859 | However, the choice of validator might affect performance. The |
---|
1860 | best approach is for the intermediate cache to use its own |
---|
1861 | validator when making its request. If the server replies with 304 |
---|
1862 | (Not Modified), then the cache can return its now validated copy |
---|
1863 | to the client with a 200 (OK) response. If the server replies |
---|
1864 | with a new entity and cache validator, however, the intermediate |
---|
1865 | cache can compare the returned validator with the one provided in |
---|
1866 | the client's request, using the strong comparison function. If |
---|
1867 | the client's validator is equal to the origin server's, then the |
---|
1868 | intermediate cache simply returns 304 (Not Modified). Otherwise, |
---|
1869 | it returns the new entity with a 200 (OK) response. |
---|
1870 | |
---|
1871 | If a request includes the no-cache directive, it SHOULD NOT |
---|
1872 | include min-fresh, max-stale, or max-age. |
---|
1873 | |
---|
1874 | only-if-cached |
---|
1875 | |
---|
1876 | In some cases, such as times of extremely poor network |
---|
1877 | connectivity, a client may want a cache to return only those |
---|
1878 | responses that it currently has stored, and not to reload or |
---|
1879 | revalidate with the origin server. To do this, the client may |
---|
1880 | include the only-if-cached directive in a request. If it receives |
---|
1881 | this directive, a cache SHOULD either respond using a cached entry |
---|
1882 | that is consistent with the other constraints of the request, or |
---|
1883 | respond with a 504 (Gateway Timeout) status. However, if a group |
---|
1884 | of caches is being operated as a unified system with good internal |
---|
1885 | connectivity, such a request MAY be forwarded within that group of |
---|
1886 | caches. |
---|
1887 | |
---|
1888 | must-revalidate |
---|
1889 | |
---|
1890 | Because a cache MAY be configured to ignore a server's specified |
---|
1891 | expiration time, and because a client request MAY include a max- |
---|
1892 | stale directive (which has a similar effect), the protocol also |
---|
1893 | includes a mechanism for the origin server to require revalidation |
---|
1894 | of a cache entry on any subsequent use. When the must-revalidate |
---|
1895 | directive is present in a response received by a cache, that cache |
---|
1896 | MUST NOT use the entry after it becomes stale to respond to a |
---|
1897 | subsequent request without first revalidating it with the origin |
---|
1898 | server. (I.e., the cache MUST do an end-to-end revalidation every |
---|
1899 | time, if, based solely on the origin server's Expires or max-age |
---|
1900 | |
---|
1901 | |
---|
1902 | |
---|
1903 | Fielding, et al. Expires December 19, 2008 [Page 34] |
---|
1904 | |
---|
1905 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1906 | |
---|
1907 | |
---|
1908 | value, the cached response is stale.) |
---|
1909 | |
---|
1910 | The must-revalidate directive is necessary to support reliable |
---|
1911 | operation for certain protocol features. In all circumstances an |
---|
1912 | HTTP/1.1 cache MUST obey the must-revalidate directive; in |
---|
1913 | particular, if the cache cannot reach the origin server for any |
---|
1914 | reason, it MUST generate a 504 (Gateway Timeout) response. |
---|
1915 | |
---|
1916 | Servers SHOULD send the must-revalidate directive if and only if |
---|
1917 | failure to revalidate a request on the entity could result in |
---|
1918 | incorrect operation, such as a silently unexecuted financial |
---|
1919 | transaction. Recipients MUST NOT take any automated action that |
---|
1920 | violates this directive, and MUST NOT automatically provide an |
---|
1921 | unvalidated copy of the entity if revalidation fails. |
---|
1922 | |
---|
1923 | Although this is not recommended, user agents operating under |
---|
1924 | severe connectivity constraints MAY violate this directive but, if |
---|
1925 | so, MUST explicitly warn the user that an unvalidated response has |
---|
1926 | been provided. The warning MUST be provided on each unvalidated |
---|
1927 | access, and SHOULD require explicit user confirmation. |
---|
1928 | |
---|
1929 | proxy-revalidate |
---|
1930 | |
---|
1931 | The proxy-revalidate directive has the same meaning as the must- |
---|
1932 | revalidate directive, except that it does not apply to non-shared |
---|
1933 | user agent caches. It can be used on a response to an |
---|
1934 | authenticated request to permit the user's cache to store and |
---|
1935 | later return the response without needing to revalidate it (since |
---|
1936 | it has already been authenticated once by that user), while still |
---|
1937 | requiring proxies that service many users to revalidate each time |
---|
1938 | (in order to make sure that each user has been authenticated). |
---|
1939 | Note that such authenticated responses also need the public cache |
---|
1940 | control directive in order to allow them to be cached at all. |
---|
1941 | |
---|
1942 | 16.2.5. No-Transform Directive |
---|
1943 | |
---|
1944 | no-transform |
---|
1945 | |
---|
1946 | Implementors of intermediate caches (proxies) have found it useful |
---|
1947 | to convert the media type of certain entity bodies. A non- |
---|
1948 | transparent proxy might, for example, convert between image |
---|
1949 | formats in order to save cache space or to reduce the amount of |
---|
1950 | traffic on a slow link. |
---|
1951 | |
---|
1952 | Serious operational problems occur, however, when these |
---|
1953 | transformations are applied to entity bodies intended for certain |
---|
1954 | kinds of applications. For example, applications for medical |
---|
1955 | imaging, scientific data analysis and those using end-to-end |
---|
1956 | |
---|
1957 | |
---|
1958 | |
---|
1959 | Fielding, et al. Expires December 19, 2008 [Page 35] |
---|
1960 | |
---|
1961 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
1962 | |
---|
1963 | |
---|
1964 | authentication, all depend on receiving an entity body that is bit |
---|
1965 | for bit identical to the original entity-body. |
---|
1966 | |
---|
1967 | Therefore, if a message includes the no-transform directive, an |
---|
1968 | intermediate cache or proxy MUST NOT change those headers that are |
---|
1969 | listed in Section 7.2 as being subject to the no-transform |
---|
1970 | directive. This implies that the cache or proxy MUST NOT change |
---|
1971 | any aspect of the entity-body that is specified by these headers, |
---|
1972 | including the value of the entity-body itself. |
---|
1973 | |
---|
1974 | 16.2.6. Cache Control Extensions |
---|
1975 | |
---|
1976 | The Cache-Control header field can be extended through the use of one |
---|
1977 | or more cache-extension tokens, each with an optional assigned value. |
---|
1978 | Informational extensions (those which do not require a change in |
---|
1979 | cache behavior) MAY be added without changing the semantics of other |
---|
1980 | directives. Behavioral extensions are designed to work by acting as |
---|
1981 | modifiers to the existing base of cache directives. Both the new |
---|
1982 | directive and the standard directive are supplied, such that |
---|
1983 | applications which do not understand the new directive will default |
---|
1984 | to the behavior specified by the standard directive, and those that |
---|
1985 | understand the new directive will recognize it as modifying the |
---|
1986 | requirements associated with the standard directive. In this way, |
---|
1987 | extensions to the cache-control directives can be made without |
---|
1988 | requiring changes to the base protocol. |
---|
1989 | |
---|
1990 | This extension mechanism depends on an HTTP cache obeying all of the |
---|
1991 | cache-control directives defined for its native HTTP-version, obeying |
---|
1992 | certain extensions, and ignoring all directives that it does not |
---|
1993 | understand. |
---|
1994 | |
---|
1995 | For example, consider a hypothetical new response directive called |
---|
1996 | community which acts as a modifier to the private directive. We |
---|
1997 | define this new directive to mean that, in addition to any non-shared |
---|
1998 | cache, any cache which is shared only by members of the community |
---|
1999 | named within its value may cache the response. An origin server |
---|
2000 | wishing to allow the UCI community to use an otherwise private |
---|
2001 | response in their shared cache(s) could do so by including |
---|
2002 | |
---|
2003 | Cache-Control: private, community="UCI" |
---|
2004 | |
---|
2005 | A cache seeing this header field will act correctly even if the cache |
---|
2006 | does not understand the community cache-extension, since it will also |
---|
2007 | see and understand the private directive and thus default to the safe |
---|
2008 | behavior. |
---|
2009 | |
---|
2010 | Unrecognized cache-directives MUST be ignored; it is assumed that any |
---|
2011 | cache-directive likely to be unrecognized by an HTTP/1.1 cache will |
---|
2012 | |
---|
2013 | |
---|
2014 | |
---|
2015 | Fielding, et al. Expires December 19, 2008 [Page 36] |
---|
2016 | |
---|
2017 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2018 | |
---|
2019 | |
---|
2020 | be combined with standard directives (or the response's default |
---|
2021 | cacheability) such that the cache behavior will remain minimally |
---|
2022 | correct even if the cache does not understand the extension(s). |
---|
2023 | |
---|
2024 | 16.3. Expires |
---|
2025 | |
---|
2026 | The Expires entity-header field gives the date/time after which the |
---|
2027 | response is considered stale. A stale cache entry may not normally |
---|
2028 | be returned by a cache (either a proxy cache or a user agent cache) |
---|
2029 | unless it is first validated with the origin server (or with an |
---|
2030 | intermediate cache that has a fresh copy of the entity). See |
---|
2031 | Section 4 for further discussion of the expiration model. |
---|
2032 | |
---|
2033 | The presence of an Expires field does not imply that the original |
---|
2034 | resource will change or cease to exist at, before, or after that |
---|
2035 | time. |
---|
2036 | |
---|
2037 | The format is an absolute date and time as defined by HTTP-date in |
---|
2038 | Section 3.3.1 of [Part1]; it MUST be sent in rfc1123-date format. |
---|
2039 | |
---|
2040 | Expires = "Expires" ":" HTTP-date |
---|
2041 | |
---|
2042 | An example of its use is |
---|
2043 | |
---|
2044 | Expires: Thu, 01 Dec 1994 16:00:00 GMT |
---|
2045 | |
---|
2046 | Note: if a response includes a Cache-Control field with the max- |
---|
2047 | age directive (see Section 16.2.3), that directive overrides the |
---|
2048 | Expires field. |
---|
2049 | |
---|
2050 | HTTP/1.1 clients and caches MUST treat other invalid date formats, |
---|
2051 | especially including the value "0", as in the past (i.e., "already |
---|
2052 | expired"). |
---|
2053 | |
---|
2054 | To mark a response as "already expired," an origin server sends an |
---|
2055 | Expires date that is equal to the Date header value. (See the rules |
---|
2056 | for expiration calculations in Section 4.4.) |
---|
2057 | |
---|
2058 | To mark a response as "never expires," an origin server sends an |
---|
2059 | Expires date approximately one year from the time the response is |
---|
2060 | sent. HTTP/1.1 servers SHOULD NOT send Expires dates more than one |
---|
2061 | year in the future. |
---|
2062 | |
---|
2063 | The presence of an Expires header field with a date value of some |
---|
2064 | time in the future on a response that otherwise would by default be |
---|
2065 | non-cacheable indicates that the response is cacheable, unless |
---|
2066 | indicated otherwise by a Cache-Control header field (Section 16.2). |
---|
2067 | |
---|
2068 | |
---|
2069 | |
---|
2070 | |
---|
2071 | Fielding, et al. Expires December 19, 2008 [Page 37] |
---|
2072 | |
---|
2073 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2074 | |
---|
2075 | |
---|
2076 | 16.4. Pragma |
---|
2077 | |
---|
2078 | The Pragma general-header field is used to include implementation- |
---|
2079 | specific directives that might apply to any recipient along the |
---|
2080 | request/response chain. All pragma directives specify optional |
---|
2081 | behavior from the viewpoint of the protocol; however, some systems |
---|
2082 | MAY require that behavior be consistent with the directives. |
---|
2083 | |
---|
2084 | Pragma = "Pragma" ":" 1#pragma-directive |
---|
2085 | pragma-directive = "no-cache" | extension-pragma |
---|
2086 | extension-pragma = token [ "=" ( token | quoted-string ) ] |
---|
2087 | |
---|
2088 | When the no-cache directive is present in a request message, an |
---|
2089 | application SHOULD forward the request toward the origin server even |
---|
2090 | if it has a cached copy of what is being requested. This pragma |
---|
2091 | directive has the same semantics as the no-cache cache-directive (see |
---|
2092 | Section 16.2) and is defined here for backward compatibility with |
---|
2093 | HTTP/1.0. Clients SHOULD include both header fields when a no-cache |
---|
2094 | request is sent to a server not known to be HTTP/1.1 compliant. |
---|
2095 | |
---|
2096 | Pragma directives MUST be passed through by a proxy or gateway |
---|
2097 | application, regardless of their significance to that application, |
---|
2098 | since the directives might be applicable to all recipients along the |
---|
2099 | request/response chain. It is not possible to specify a pragma for a |
---|
2100 | specific recipient; however, any pragma directive not relevant to a |
---|
2101 | recipient SHOULD be ignored by that recipient. |
---|
2102 | |
---|
2103 | HTTP/1.1 caches SHOULD treat "Pragma: no-cache" as if the client had |
---|
2104 | sent "Cache-Control: no-cache". No new Pragma directives will be |
---|
2105 | defined in HTTP. |
---|
2106 | |
---|
2107 | Note: because the meaning of "Pragma: no-cache" as a response- |
---|
2108 | header field is not actually specified, it does not provide a |
---|
2109 | reliable replacement for "Cache-Control: no-cache" in a response. |
---|
2110 | |
---|
2111 | 16.5. Vary |
---|
2112 | |
---|
2113 | The Vary field value indicates the set of request-header fields that |
---|
2114 | fully determines, while the response is fresh, whether a cache is |
---|
2115 | permitted to use the response to reply to a subsequent request |
---|
2116 | without revalidation. For uncacheable or stale responses, the Vary |
---|
2117 | field value advises the user agent about the criteria that were used |
---|
2118 | to select the representation. A Vary field value of "*" implies that |
---|
2119 | a cache cannot determine from the request headers of a subsequent |
---|
2120 | request whether this response is the appropriate representation. See |
---|
2121 | Section 8 for use of the Vary header field by caches. |
---|
2122 | |
---|
2123 | Vary = "Vary" ":" ( "*" | 1#field-name ) |
---|
2124 | |
---|
2125 | |
---|
2126 | |
---|
2127 | Fielding, et al. Expires December 19, 2008 [Page 38] |
---|
2128 | |
---|
2129 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2130 | |
---|
2131 | |
---|
2132 | An HTTP/1.1 server SHOULD include a Vary header field with any |
---|
2133 | cacheable response that is subject to server-driven negotiation. |
---|
2134 | Doing so allows a cache to properly interpret future requests on that |
---|
2135 | resource and informs the user agent about the presence of negotiation |
---|
2136 | on that resource. A server MAY include a Vary header field with a |
---|
2137 | non-cacheable response that is subject to server-driven negotiation, |
---|
2138 | since this might provide the user agent with useful information about |
---|
2139 | the dimensions over which the response varies at the time of the |
---|
2140 | response. |
---|
2141 | |
---|
2142 | A Vary field value consisting of a list of field-names signals that |
---|
2143 | the representation selected for the response is based on a selection |
---|
2144 | algorithm which considers ONLY the listed request-header field values |
---|
2145 | in selecting the most appropriate representation. A cache MAY assume |
---|
2146 | that the same selection will be made for future requests with the |
---|
2147 | same values for the listed field names, for the duration of time for |
---|
2148 | which the response is fresh. |
---|
2149 | |
---|
2150 | The field-names given are not limited to the set of standard request- |
---|
2151 | header fields defined by this specification. Field names are case- |
---|
2152 | insensitive. |
---|
2153 | |
---|
2154 | A Vary field value of "*" signals that unspecified parameters not |
---|
2155 | limited to the request-headers (e.g., the network address of the |
---|
2156 | client), play a role in the selection of the response representation. |
---|
2157 | The "*" value MUST NOT be generated by a proxy server; it may only be |
---|
2158 | generated by an origin server. |
---|
2159 | |
---|
2160 | 16.6. Warning |
---|
2161 | |
---|
2162 | The Warning general-header field is used to carry additional |
---|
2163 | information about the status or transformation of a message which |
---|
2164 | might not be reflected in the message. This information is typically |
---|
2165 | used to warn about a possible lack of semantic transparency from |
---|
2166 | caching operations or transformations applied to the entity body of |
---|
2167 | the message. |
---|
2168 | |
---|
2169 | Warning headers are sent with responses using: |
---|
2170 | |
---|
2171 | |
---|
2172 | |
---|
2173 | |
---|
2174 | |
---|
2175 | |
---|
2176 | |
---|
2177 | |
---|
2178 | |
---|
2179 | |
---|
2180 | |
---|
2181 | |
---|
2182 | |
---|
2183 | Fielding, et al. Expires December 19, 2008 [Page 39] |
---|
2184 | |
---|
2185 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2186 | |
---|
2187 | |
---|
2188 | Warning = "Warning" ":" 1#warning-value |
---|
2189 | |
---|
2190 | warning-value = warn-code SP warn-agent SP warn-text |
---|
2191 | [SP warn-date] |
---|
2192 | |
---|
2193 | warn-code = 3DIGIT |
---|
2194 | warn-agent = ( uri-host [ ":" port ] ) | pseudonym |
---|
2195 | ; the name or pseudonym of the server adding |
---|
2196 | ; the Warning header, for use in debugging |
---|
2197 | warn-text = quoted-string |
---|
2198 | warn-date = DQUOTE HTTP-date DQUOTE |
---|
2199 | |
---|
2200 | A response MAY carry more than one Warning header. |
---|
2201 | |
---|
2202 | The warn-text SHOULD be in a natural language and character set that |
---|
2203 | is most likely to be intelligible to the human user receiving the |
---|
2204 | response. This decision MAY be based on any available knowledge, |
---|
2205 | such as the location of the cache or user, the Accept-Language field |
---|
2206 | in a request, the Content-Language field in a response, etc. The |
---|
2207 | default language is English and the default character set is ISO- |
---|
2208 | 8859-1 ([ISO-8859-1]). |
---|
2209 | |
---|
2210 | If a character set other than ISO-8859-1 is used, it MUST be encoded |
---|
2211 | in the warn-text using the method described in [RFC2047]. |
---|
2212 | |
---|
2213 | Warning headers can in general be applied to any message, however |
---|
2214 | some specific warn-codes are specific to caches and can only be |
---|
2215 | applied to response messages. New Warning headers SHOULD be added |
---|
2216 | after any existing Warning headers. A cache MUST NOT delete any |
---|
2217 | Warning header that it received with a message. However, if a cache |
---|
2218 | successfully validates a cache entry, it SHOULD remove any Warning |
---|
2219 | headers previously attached to that entry except as specified for |
---|
2220 | specific Warning codes. It MUST then add any Warning headers |
---|
2221 | received in the validating response. In other words, Warning headers |
---|
2222 | are those that would be attached to the most recent relevant |
---|
2223 | response. |
---|
2224 | |
---|
2225 | When multiple Warning headers are attached to a response, the user |
---|
2226 | agent ought to inform the user of as many of them as possible, in the |
---|
2227 | order that they appear in the response. If it is not possible to |
---|
2228 | inform the user of all of the warnings, the user agent SHOULD follow |
---|
2229 | these heuristics: |
---|
2230 | |
---|
2231 | o Warnings that appear early in the response take priority over |
---|
2232 | those appearing later in the response. |
---|
2233 | |
---|
2234 | o Warnings in the user's preferred character set take priority over |
---|
2235 | warnings in other character sets but with identical warn-codes and |
---|
2236 | |
---|
2237 | |
---|
2238 | |
---|
2239 | Fielding, et al. Expires December 19, 2008 [Page 40] |
---|
2240 | |
---|
2241 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2242 | |
---|
2243 | |
---|
2244 | warn-agents. |
---|
2245 | |
---|
2246 | Systems that generate multiple Warning headers SHOULD order them with |
---|
2247 | this user agent behavior in mind. |
---|
2248 | |
---|
2249 | Requirements for the behavior of caches with respect to Warnings are |
---|
2250 | stated in Section 3.2. |
---|
2251 | |
---|
2252 | This is a list of the currently-defined warn-codes, each with a |
---|
2253 | recommended warn-text in English, and a description of its meaning. |
---|
2254 | |
---|
2255 | 110 Response is stale |
---|
2256 | |
---|
2257 | MUST be included whenever the returned response is stale. |
---|
2258 | |
---|
2259 | 111 Revalidation failed |
---|
2260 | |
---|
2261 | MUST be included if a cache returns a stale response because an |
---|
2262 | attempt to revalidate the response failed, due to an inability to |
---|
2263 | reach the server. |
---|
2264 | |
---|
2265 | 112 Disconnected operation |
---|
2266 | |
---|
2267 | SHOULD be included if the cache is intentionally disconnected from |
---|
2268 | the rest of the network for a period of time. |
---|
2269 | |
---|
2270 | 113 Heuristic expiration |
---|
2271 | |
---|
2272 | MUST be included if the cache heuristically chose a freshness |
---|
2273 | lifetime greater than 24 hours and the response's age is greater |
---|
2274 | than 24 hours. |
---|
2275 | |
---|
2276 | 199 Miscellaneous warning |
---|
2277 | |
---|
2278 | The warning text MAY include arbitrary information to be presented |
---|
2279 | to a human user, or logged. A system receiving this warning MUST |
---|
2280 | NOT take any automated action, besides presenting the warning to |
---|
2281 | the user. |
---|
2282 | |
---|
2283 | 214 Transformation applied |
---|
2284 | |
---|
2285 | MUST be added by an intermediate cache or proxy if it applies any |
---|
2286 | transformation changing the content-coding (as specified in the |
---|
2287 | Content-Encoding header) or media-type (as specified in the |
---|
2288 | Content-Type header) of the response, or the entity-body of the |
---|
2289 | response, unless this Warning code already appears in the |
---|
2290 | response. |
---|
2291 | |
---|
2292 | |
---|
2293 | |
---|
2294 | |
---|
2295 | Fielding, et al. Expires December 19, 2008 [Page 41] |
---|
2296 | |
---|
2297 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2298 | |
---|
2299 | |
---|
2300 | 299 Miscellaneous persistent warning |
---|
2301 | |
---|
2302 | The warning text MAY include arbitrary information to be presented |
---|
2303 | to a human user, or logged. A system receiving this warning MUST |
---|
2304 | NOT take any automated action. |
---|
2305 | |
---|
2306 | If an implementation sends a message with one or more Warning headers |
---|
2307 | whose version is HTTP/1.0 or lower, then the sender MUST include in |
---|
2308 | each warning-value a warn-date that matches the date in the response. |
---|
2309 | |
---|
2310 | If an implementation receives a message with a warning-value that |
---|
2311 | includes a warn-date, and that warn-date is different from the Date |
---|
2312 | value in the response, then that warning-value MUST be deleted from |
---|
2313 | the message before storing, forwarding, or using it. (This prevents |
---|
2314 | bad consequences of naive caching of Warning header fields.) If all |
---|
2315 | of the warning-values are deleted for this reason, the Warning header |
---|
2316 | MUST be deleted as well. |
---|
2317 | |
---|
2318 | |
---|
2319 | 17. IANA Considerations |
---|
2320 | |
---|
2321 | 17.1. Message Header Registration |
---|
2322 | |
---|
2323 | The Message Header Registry located at <http://www.iana.org/ |
---|
2324 | assignments/message-headers/message-header-index.html> should be |
---|
2325 | updated with the permanent registrations below (see [RFC3864]): |
---|
2326 | |
---|
2327 | +-------------------+----------+----------+--------------+ |
---|
2328 | | Header Field Name | Protocol | Status | Reference | |
---|
2329 | +-------------------+----------+----------+--------------+ |
---|
2330 | | Age | http | standard | Section 16.1 | |
---|
2331 | | Cache-Control | http | standard | Section 16.2 | |
---|
2332 | | Expires | http | standard | Section 16.3 | |
---|
2333 | | Pragma | http | standard | Section 16.4 | |
---|
2334 | | Vary | http | standard | Section 16.5 | |
---|
2335 | | Warning | http | standard | Section 16.6 | |
---|
2336 | +-------------------+----------+----------+--------------+ |
---|
2337 | |
---|
2338 | The change controller is: "IETF (iesg@ietf.org) - Internet |
---|
2339 | Engineering Task Force". |
---|
2340 | |
---|
2341 | |
---|
2342 | 18. Security Considerations |
---|
2343 | |
---|
2344 | Caching proxies provide additional potential vulnerabilities, since |
---|
2345 | the contents of the cache represent an attractive target for |
---|
2346 | malicious exploitation. Because cache contents persist after an HTTP |
---|
2347 | request is complete, an attack on the cache can reveal information |
---|
2348 | |
---|
2349 | |
---|
2350 | |
---|
2351 | Fielding, et al. Expires December 19, 2008 [Page 42] |
---|
2352 | |
---|
2353 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2354 | |
---|
2355 | |
---|
2356 | long after a user believes that the information has been removed from |
---|
2357 | the network. Therefore, cache contents should be protected as |
---|
2358 | sensitive information. |
---|
2359 | |
---|
2360 | |
---|
2361 | 19. Acknowledgments |
---|
2362 | |
---|
2363 | Much of the content and presentation of the caching design is due to |
---|
2364 | suggestions and comments from individuals including: Shel Kaphan, |
---|
2365 | Paul Leach, Koen Holtman, David Morris, and Larry Masinter. |
---|
2366 | |
---|
2367 | |
---|
2368 | 20. References |
---|
2369 | |
---|
2370 | 20.1. Normative References |
---|
2371 | |
---|
2372 | [ISO-8859-1] |
---|
2373 | International Organization for Standardization, |
---|
2374 | "Information technology -- 8-bit single-byte coded graphic |
---|
2375 | character sets -- Part 1: Latin alphabet No. 1", ISO/ |
---|
2376 | IEC 8859-1:1998, 1998. |
---|
2377 | |
---|
2378 | [Part1] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., |
---|
2379 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., |
---|
2380 | and J. Reschke, Ed., "HTTP/1.1, part 1: URIs, Connections, |
---|
2381 | and Message Parsing", draft-ietf-httpbis-p1-messaging-03 |
---|
2382 | (work in progress), June 2008. |
---|
2383 | |
---|
2384 | [Part2] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., |
---|
2385 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., |
---|
2386 | and J. Reschke, Ed., "HTTP/1.1, part 2: Message |
---|
2387 | Semantics", draft-ietf-httpbis-p2-semantics-03 (work in |
---|
2388 | progress), June 2008. |
---|
2389 | |
---|
2390 | [Part3] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., |
---|
2391 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., |
---|
2392 | and J. Reschke, Ed., "HTTP/1.1, part 3: Message Payload |
---|
2393 | and Content Negotiation", draft-ietf-httpbis-p3-payload-03 |
---|
2394 | (work in progress), June 2008. |
---|
2395 | |
---|
2396 | [Part4] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., |
---|
2397 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., |
---|
2398 | and J. Reschke, Ed., "HTTP/1.1, part 4: Conditional |
---|
2399 | Requests", draft-ietf-httpbis-p4-conditional-03 (work in |
---|
2400 | progress), June 2008. |
---|
2401 | |
---|
2402 | [Part5] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., |
---|
2403 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., |
---|
2404 | |
---|
2405 | |
---|
2406 | |
---|
2407 | Fielding, et al. Expires December 19, 2008 [Page 43] |
---|
2408 | |
---|
2409 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2410 | |
---|
2411 | |
---|
2412 | and J. Reschke, Ed., "HTTP/1.1, part 5: Range Requests and |
---|
2413 | Partial Responses", draft-ietf-httpbis-p5-range-03 (work |
---|
2414 | in progress), June 2008. |
---|
2415 | |
---|
2416 | [Part7] Fielding, R., Ed., Gettys, J., Mogul, J., Frystyk, H., |
---|
2417 | Masinter, L., Leach, P., Berners-Lee, T., Lafon, Y., Ed., |
---|
2418 | and J. Reschke, Ed., "HTTP/1.1, part 7: Authentication", |
---|
2419 | draft-ietf-httpbis-p7-auth-03 (work in progress), |
---|
2420 | June 2008. |
---|
2421 | |
---|
2422 | [RFC2047] Moore, K., "MIME (Multipurpose Internet Mail Extensions) |
---|
2423 | Part Three: Message Header Extensions for Non-ASCII Text", |
---|
2424 | RFC 2047, November 1996. |
---|
2425 | |
---|
2426 | [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate |
---|
2427 | Requirement Levels", BCP 14, RFC 2119, March 1997. |
---|
2428 | |
---|
2429 | 20.2. Informative References |
---|
2430 | |
---|
2431 | [RFC1305] Mills, D., "Network Time Protocol (Version 3) |
---|
2432 | Specification, Implementation", RFC 1305, March 1992. |
---|
2433 | |
---|
2434 | [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., |
---|
2435 | Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext |
---|
2436 | Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. |
---|
2437 | |
---|
2438 | [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration |
---|
2439 | Procedures for Message Header Fields", BCP 90, RFC 3864, |
---|
2440 | September 2004. |
---|
2441 | |
---|
2442 | |
---|
2443 | Appendix A. Compatibility with Previous Versions |
---|
2444 | |
---|
2445 | A.1. Changes from RFC 2068 |
---|
2446 | |
---|
2447 | A case was missed in the Cache-Control model of HTTP/1.1; s-maxage |
---|
2448 | was introduced to add this missing case. (Sections 6, 16.2, 16.2.3) |
---|
2449 | |
---|
2450 | Transfer-coding and message lengths all interact in ways that |
---|
2451 | required fixing exactly when chunked encoding is used (to allow for |
---|
2452 | transfer encoding that may not be self delimiting); it was important |
---|
2453 | to straighten out exactly how message lengths are computed. |
---|
2454 | (Section 7.2, see also [Part1], [Part3] and [Part5]) |
---|
2455 | |
---|
2456 | Proxies should be able to add Content-Length when appropriate. |
---|
2457 | (Section 7.2) |
---|
2458 | |
---|
2459 | Range request responses would become very verbose if all meta-data |
---|
2460 | |
---|
2461 | |
---|
2462 | |
---|
2463 | Fielding, et al. Expires December 19, 2008 [Page 44] |
---|
2464 | |
---|
2465 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2466 | |
---|
2467 | |
---|
2468 | were always returned; by allowing the server to only send needed |
---|
2469 | headers in a 206 response, this problem can be avoided. |
---|
2470 | (Section 7.3) |
---|
2471 | |
---|
2472 | The Cache-Control: max-age directive was not properly defined for |
---|
2473 | responses. (Section 16.2.3) |
---|
2474 | |
---|
2475 | Warnings could be cached incorrectly, or not updated appropriately. |
---|
2476 | (Section 3.2, 4.4, 7.2, 7.3, 16.2.3, and 16.6) Warning also needed to |
---|
2477 | be a general header, as PUT or other methods may have need for it in |
---|
2478 | requests. |
---|
2479 | |
---|
2480 | A.2. Changes from RFC 2616 |
---|
2481 | |
---|
2482 | Clarify denial of service attack avoidance requirement. (Section 12) |
---|
2483 | |
---|
2484 | |
---|
2485 | Appendix B. Change Log (to be removed by RFC Editor before publication) |
---|
2486 | |
---|
2487 | B.1. Since RFC2616 |
---|
2488 | |
---|
2489 | Extracted relevant partitions from [RFC2616]. |
---|
2490 | |
---|
2491 | B.2. Since draft-ietf-httpbis-p6-cache-00 |
---|
2492 | |
---|
2493 | Closed issues: |
---|
2494 | |
---|
2495 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/9>: "Trailer" |
---|
2496 | (<http://purl.org/NET/http-errata#trailer-hop>) |
---|
2497 | |
---|
2498 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/12>: |
---|
2499 | "Invalidation after Update or Delete" |
---|
2500 | (<http://purl.org/NET/http-errata#invalidupd>) |
---|
2501 | |
---|
2502 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/35>: "Normative |
---|
2503 | and Informative references" |
---|
2504 | |
---|
2505 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/48>: "Date |
---|
2506 | reference typo" |
---|
2507 | |
---|
2508 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/49>: |
---|
2509 | "Connection header text" |
---|
2510 | |
---|
2511 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/65>: |
---|
2512 | "Informative references" |
---|
2513 | |
---|
2514 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/66>: |
---|
2515 | "ISO-8859-1 Reference" |
---|
2516 | |
---|
2517 | |
---|
2518 | |
---|
2519 | Fielding, et al. Expires December 19, 2008 [Page 45] |
---|
2520 | |
---|
2521 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2522 | |
---|
2523 | |
---|
2524 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/86>: "Normative |
---|
2525 | up-to-date references" |
---|
2526 | |
---|
2527 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/87>: "typo in |
---|
2528 | 13.2.2" |
---|
2529 | |
---|
2530 | Other changes: |
---|
2531 | |
---|
2532 | o Use names of RFC4234 core rules DQUOTE and HTAB (work in progress |
---|
2533 | on <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/36>) |
---|
2534 | |
---|
2535 | B.3. Since draft-ietf-httpbis-p6-cache-01 |
---|
2536 | |
---|
2537 | Closed issues: |
---|
2538 | |
---|
2539 | o <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/82>: "rel_path |
---|
2540 | not used" |
---|
2541 | |
---|
2542 | Other changes: |
---|
2543 | |
---|
2544 | o Get rid of duplicate BNF rule names ("host" -> "uri-host") (work |
---|
2545 | in progress on |
---|
2546 | <http://www3.tools.ietf.org/wg/httpbis/trac/ticket/36>) |
---|
2547 | |
---|
2548 | o Add explicit references to BNF syntax and rules imported from |
---|
2549 | other parts of the specification. |
---|
2550 | |
---|
2551 | B.4. Since draft-ietf-httpbis-p6-cache-02 |
---|
2552 | |
---|
2553 | Ongoing work on IANA Message Header Registration |
---|
2554 | (<http://www3.tools.ietf.org/wg/httpbis/trac/ticket/40>): |
---|
2555 | |
---|
2556 | o Reference RFC 3984, and update header registrations for headers |
---|
2557 | defined in this document. |
---|
2558 | |
---|
2559 | |
---|
2560 | Index |
---|
2561 | |
---|
2562 | A |
---|
2563 | age 7 |
---|
2564 | Age header 27 |
---|
2565 | |
---|
2566 | C |
---|
2567 | cache 5 |
---|
2568 | Cache Directives |
---|
2569 | max-age 32-33 |
---|
2570 | max-stale 32 |
---|
2571 | min-fresh 32 |
---|
2572 | |
---|
2573 | |
---|
2574 | |
---|
2575 | Fielding, et al. Expires December 19, 2008 [Page 46] |
---|
2576 | |
---|
2577 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2578 | |
---|
2579 | |
---|
2580 | must-revalidate 34 |
---|
2581 | no-cache 29 |
---|
2582 | no-store 30 |
---|
2583 | no-transform 35 |
---|
2584 | only-if-cached 34 |
---|
2585 | private 29 |
---|
2586 | proxy-revalidate 35 |
---|
2587 | public 29 |
---|
2588 | s-maxage 31 |
---|
2589 | Cache-Control header 27 |
---|
2590 | cacheable 6 |
---|
2591 | |
---|
2592 | E |
---|
2593 | Expires header 37 |
---|
2594 | explicit expiration time 7 |
---|
2595 | |
---|
2596 | F |
---|
2597 | first-hand 6 |
---|
2598 | fresh 7 |
---|
2599 | freshness lifetime 7 |
---|
2600 | |
---|
2601 | G |
---|
2602 | Grammar |
---|
2603 | Age 27 |
---|
2604 | age-value 27 |
---|
2605 | Cache-Control 28 |
---|
2606 | cache-directive 28 |
---|
2607 | cache-extension 28 |
---|
2608 | cache-request-directive 28 |
---|
2609 | cache-response-directive 28 |
---|
2610 | delta-seconds 27 |
---|
2611 | Expires 37 |
---|
2612 | extension-pragma 38 |
---|
2613 | Pragma 38 |
---|
2614 | pragma-directive 38 |
---|
2615 | Vary 38 |
---|
2616 | warn-agent 40 |
---|
2617 | warn-code 40 |
---|
2618 | warn-date 40 |
---|
2619 | warn-text 40 |
---|
2620 | Warning 40 |
---|
2621 | warning-value 40 |
---|
2622 | |
---|
2623 | H |
---|
2624 | Headers |
---|
2625 | Age 27 |
---|
2626 | Cache-Control 27 |
---|
2627 | Expires 37 |
---|
2628 | |
---|
2629 | |
---|
2630 | |
---|
2631 | Fielding, et al. Expires December 19, 2008 [Page 47] |
---|
2632 | |
---|
2633 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2634 | |
---|
2635 | |
---|
2636 | Pragma 38 |
---|
2637 | Vary 38 |
---|
2638 | Warning 39 |
---|
2639 | heuristic expiration time 7 |
---|
2640 | |
---|
2641 | M |
---|
2642 | max-age |
---|
2643 | Cache Directive 32-33 |
---|
2644 | max-stale |
---|
2645 | Cache Directive 32 |
---|
2646 | min-fresh |
---|
2647 | Cache Directive 32 |
---|
2648 | must-revalidate |
---|
2649 | Cache Directive 34 |
---|
2650 | |
---|
2651 | N |
---|
2652 | no-cache |
---|
2653 | Cache Directive 29 |
---|
2654 | no-store |
---|
2655 | Cache Directive 30 |
---|
2656 | no-transform |
---|
2657 | Cache Directive 35 |
---|
2658 | |
---|
2659 | O |
---|
2660 | only-if-cached |
---|
2661 | Cache Directive 34 |
---|
2662 | |
---|
2663 | P |
---|
2664 | Pragma header 38 |
---|
2665 | private |
---|
2666 | Cache Directive 29 |
---|
2667 | proxy-revalidate |
---|
2668 | Cache Directive 35 |
---|
2669 | public |
---|
2670 | Cache Directive 29 |
---|
2671 | |
---|
2672 | S |
---|
2673 | s-maxage |
---|
2674 | Cache Directive 31 |
---|
2675 | semantically transparent 5 |
---|
2676 | stale 7 |
---|
2677 | |
---|
2678 | V |
---|
2679 | validator 7 |
---|
2680 | Vary header 38 |
---|
2681 | |
---|
2682 | W |
---|
2683 | Warning header 39 |
---|
2684 | |
---|
2685 | |
---|
2686 | |
---|
2687 | Fielding, et al. Expires December 19, 2008 [Page 48] |
---|
2688 | |
---|
2689 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2690 | |
---|
2691 | |
---|
2692 | Authors' Addresses |
---|
2693 | |
---|
2694 | Roy T. Fielding (editor) |
---|
2695 | Day Software |
---|
2696 | 23 Corporate Plaza DR, Suite 280 |
---|
2697 | Newport Beach, CA 92660 |
---|
2698 | USA |
---|
2699 | |
---|
2700 | Phone: +1-949-706-5300 |
---|
2701 | Fax: +1-949-706-5305 |
---|
2702 | Email: fielding@gbiv.com |
---|
2703 | URI: http://roy.gbiv.com/ |
---|
2704 | |
---|
2705 | |
---|
2706 | Jim Gettys |
---|
2707 | One Laptop per Child |
---|
2708 | 21 Oak Knoll Road |
---|
2709 | Carlisle, MA 01741 |
---|
2710 | USA |
---|
2711 | |
---|
2712 | Email: jg@laptop.org |
---|
2713 | URI: http://www.laptop.org/ |
---|
2714 | |
---|
2715 | |
---|
2716 | Jeffrey C. Mogul |
---|
2717 | Hewlett-Packard Company |
---|
2718 | HP Labs, Large Scale Systems Group |
---|
2719 | 1501 Page Mill Road, MS 1177 |
---|
2720 | Palo Alto, CA 94304 |
---|
2721 | USA |
---|
2722 | |
---|
2723 | Email: JeffMogul@acm.org |
---|
2724 | |
---|
2725 | |
---|
2726 | Henrik Frystyk Nielsen |
---|
2727 | Microsoft Corporation |
---|
2728 | 1 Microsoft Way |
---|
2729 | Redmond, WA 98052 |
---|
2730 | USA |
---|
2731 | |
---|
2732 | Email: henrikn@microsoft.com |
---|
2733 | |
---|
2734 | |
---|
2735 | |
---|
2736 | |
---|
2737 | |
---|
2738 | |
---|
2739 | |
---|
2740 | |
---|
2741 | |
---|
2742 | |
---|
2743 | Fielding, et al. Expires December 19, 2008 [Page 49] |
---|
2744 | |
---|
2745 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2746 | |
---|
2747 | |
---|
2748 | Larry Masinter |
---|
2749 | Adobe Systems, Incorporated |
---|
2750 | 345 Park Ave |
---|
2751 | San Jose, CA 95110 |
---|
2752 | USA |
---|
2753 | |
---|
2754 | Email: LMM@acm.org |
---|
2755 | URI: http://larry.masinter.net/ |
---|
2756 | |
---|
2757 | |
---|
2758 | Paul J. Leach |
---|
2759 | Microsoft Corporation |
---|
2760 | 1 Microsoft Way |
---|
2761 | Redmond, WA 98052 |
---|
2762 | |
---|
2763 | Email: paulle@microsoft.com |
---|
2764 | |
---|
2765 | |
---|
2766 | Tim Berners-Lee |
---|
2767 | World Wide Web Consortium |
---|
2768 | MIT Computer Science and Artificial Intelligence Laboratory |
---|
2769 | The Stata Center, Building 32 |
---|
2770 | 32 Vassar Street |
---|
2771 | Cambridge, MA 02139 |
---|
2772 | USA |
---|
2773 | |
---|
2774 | Email: timbl@w3.org |
---|
2775 | URI: http://www.w3.org/People/Berners-Lee/ |
---|
2776 | |
---|
2777 | |
---|
2778 | Yves Lafon (editor) |
---|
2779 | World Wide Web Consortium |
---|
2780 | W3C / ERCIM |
---|
2781 | 2004, rte des Lucioles |
---|
2782 | Sophia-Antipolis, AM 06902 |
---|
2783 | France |
---|
2784 | |
---|
2785 | Email: ylafon@w3.org |
---|
2786 | URI: http://www.raubacapeu.net/people/yves/ |
---|
2787 | |
---|
2788 | |
---|
2789 | |
---|
2790 | |
---|
2791 | |
---|
2792 | |
---|
2793 | |
---|
2794 | |
---|
2795 | |
---|
2796 | |
---|
2797 | |
---|
2798 | |
---|
2799 | Fielding, et al. Expires December 19, 2008 [Page 50] |
---|
2800 | |
---|
2801 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2802 | |
---|
2803 | |
---|
2804 | Julian F. Reschke (editor) |
---|
2805 | greenbytes GmbH |
---|
2806 | Hafenweg 16 |
---|
2807 | Muenster, NW 48155 |
---|
2808 | Germany |
---|
2809 | |
---|
2810 | Phone: +49 251 2807760 |
---|
2811 | Fax: +49 251 2807761 |
---|
2812 | Email: julian.reschke@greenbytes.de |
---|
2813 | URI: http://greenbytes.de/tech/webdav/ |
---|
2814 | |
---|
2815 | |
---|
2816 | |
---|
2817 | |
---|
2818 | |
---|
2819 | |
---|
2820 | |
---|
2821 | |
---|
2822 | |
---|
2823 | |
---|
2824 | |
---|
2825 | |
---|
2826 | |
---|
2827 | |
---|
2828 | |
---|
2829 | |
---|
2830 | |
---|
2831 | |
---|
2832 | |
---|
2833 | |
---|
2834 | |
---|
2835 | |
---|
2836 | |
---|
2837 | |
---|
2838 | |
---|
2839 | |
---|
2840 | |
---|
2841 | |
---|
2842 | |
---|
2843 | |
---|
2844 | |
---|
2845 | |
---|
2846 | |
---|
2847 | |
---|
2848 | |
---|
2849 | |
---|
2850 | |
---|
2851 | |
---|
2852 | |
---|
2853 | |
---|
2854 | |
---|
2855 | Fielding, et al. Expires December 19, 2008 [Page 51] |
---|
2856 | |
---|
2857 | Internet-Draft HTTP/1.1, Part 6 June 2008 |
---|
2858 | |
---|
2859 | |
---|
2860 | Full Copyright Statement |
---|
2861 | |
---|
2862 | Copyright (C) The IETF Trust (2008). |
---|
2863 | |
---|
2864 | This document is subject to the rights, licenses and restrictions |
---|
2865 | contained in BCP 78, and except as set forth therein, the authors |
---|
2866 | retain all their rights. |
---|
2867 | |
---|
2868 | This document and the information contained herein are provided on an |
---|
2869 | "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS |
---|
2870 | OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND |
---|
2871 | THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS |
---|
2872 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF |
---|
2873 | THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED |
---|
2874 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. |
---|
2875 | |
---|
2876 | |
---|
2877 | Intellectual Property |
---|
2878 | |
---|
2879 | The IETF takes no position regarding the validity or scope of any |
---|
2880 | Intellectual Property Rights or other rights that might be claimed to |
---|
2881 | pertain to the implementation or use of the technology described in |
---|
2882 | this document or the extent to which any license under such rights |
---|
2883 | might or might not be available; nor does it represent that it has |
---|
2884 | made any independent effort to identify any such rights. Information |
---|
2885 | on the procedures with respect to rights in RFC documents can be |
---|
2886 | found in BCP 78 and BCP 79. |
---|
2887 | |
---|
2888 | Copies of IPR disclosures made to the IETF Secretariat and any |
---|
2889 | assurances of licenses to be made available, or the result of an |
---|
2890 | attempt made to obtain a general license or permission for the use of |
---|
2891 | such proprietary rights by implementers or users of this |
---|
2892 | specification can be obtained from the IETF on-line IPR repository at |
---|
2893 | http://www.ietf.org/ipr. |
---|
2894 | |
---|
2895 | The IETF invites any interested party to bring to its attention any |
---|
2896 | copyrights, patents or patent applications, or other proprietary |
---|
2897 | rights that may cover technology that may be required to implement |
---|
2898 | this standard. Please address the information to the IETF at |
---|
2899 | ietf-ipr@ietf.org. |
---|
2900 | |
---|
2901 | |
---|
2902 | |
---|
2903 | |
---|
2904 | |
---|
2905 | |
---|
2906 | |
---|
2907 | |
---|
2908 | |
---|
2909 | |
---|
2910 | |
---|
2911 | Fielding, et al. Expires December 19, 2008 [Page 52] |
---|
2912 | |
---|