Debian Codegraph @

rfc6585.html

raw
1 <pre>Internet Engineering Task Force (IETF) M. Nottingham
2 Request for Comments: 6585 Rackspace
3 Updates: <a href="./rfc2616">2616</a> R. Fielding
4 Category: Standards Track Adobe
5 ISSN: 2070-1721 April 2012
6
7
8 <span class="h1">Additional HTTP Status Codes</span>
9
10 Abstract
11
12 This document specifies additional HyperText Transfer Protocol (HTTP)
13 status codes for a variety of common situations.
14
15 Status of This Memo
16
17 This is an Internet Standards Track document.
18
19 This document is a product of the Internet Engineering Task Force
20 (IETF). It represents the consensus of the IETF community. It has
21 received public review and has been approved for publication by the
22 Internet Engineering Steering Group (IESG). Further information on
23 Internet Standards is available in <a href="./rfc5741#section-2">Section&nbsp;2 of RFC 5741</a>.
24
25 Information about the current status of this document, any errata,
26 and how to provide feedback on it may be obtained at
27 <a href="http://www.rfc-editor.org/info/rfc6585">http://www.rfc-editor.org/info/rfc6585</a>.
28
29 Copyright Notice
30
31 Copyright (c) 2012 IETF Trust and the persons identified as the
32 document authors. All rights reserved.
33
34 This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
35 Provisions Relating to IETF Documents
36 (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
37 publication of this document. Please review these documents
38 carefully, as they describe your rights and restrictions with respect
39 to this document. Code Components extracted from this document must
40 include Simplified BSD License text as described in Section 4.e of
41 the Trust Legal Provisions and are provided without warranty as
42 described in the Simplified BSD License.
43
44
45
46
47
48
49
50
51
52 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 1]</span></pre>
53 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
54 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
55
56
57 Table of Contents
58
59 <a href="#section-1">1</a>. Introduction ....................................................<a href="#page-2">2</a>
60 <a href="#section-2">2</a>. Requirements ....................................................<a href="#page-2">2</a>
61 <a href="#section-3">3</a>. 428 Precondition Required .......................................<a href="#page-2">2</a>
62 <a href="#section-4">4</a>. 429 Too Many Requests ...........................................<a href="#page-3">3</a>
63 <a href="#section-5">5</a>. 431 Request Header Fields Too Large .............................<a href="#page-4">4</a>
64 <a href="#section-6">6</a>. 511 Network Authentication Required .............................<a href="#page-4">4</a>
65 <a href="#section-7">7</a>. Security Considerations .........................................<a href="#page-6">6</a>
66 <a href="#section-8">8</a>. IANA Considerations .............................................<a href="#page-7">7</a>
67 <a href="#section-9">9</a>. References ......................................................<a href="#page-7">7</a>
68 <a href="#appendix-A">Appendix A</a>. Acknowledgements .......................................<a href="#page-9">9</a>
69 <a href="#appendix-B">Appendix B</a>. Issues Raised by Captive Portals .......................<a href="#page-9">9</a>
70
71 <span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
72
73 This document specifies additional HTTP [<a href="./rfc2616" title="&quot;Hypertext Transfer Protocol -- HTTP/1.1&quot;">RFC2616</a>] status codes for a
74 variety of common situations, to improve interoperability and avoid
75 confusion when other, less precise status codes are used.
76
77 Note that these status codes are optional; servers cannot be required
78 to support them. However, because clients will treat unknown status
79 codes as a generic error of the same class (e.g., 499 is treated as
80 400 if it is not recognized), they can be safely deployed by existing
81 servers (see <a href="./rfc2616#section-6.1.1">[RFC2616] Section&nbsp;6.1.1</a> for more information).
82
83 <span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Requirements</span>
84
85 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
86 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
87 document are to be interpreted as described in [<a href="./rfc2119" title="&quot;Key words for use in RFCs to Indicate Requirement Levels&quot;">RFC2119</a>].
88
89 <span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. 428 Precondition Required</span>
90
91 The 428 status code indicates that the origin server requires the
92 request to be conditional.
93
94 Its typical use is to avoid the "lost update" problem, where a client
95 GETs a resource's state, modifies it, and PUTs it back to the server,
96 when meanwhile a third party has modified the state on the server,
97 leading to a conflict. By requiring requests to be conditional, the
98 server can assure that clients are working with the correct copies.
99
100 Responses using this status code SHOULD explain how to resubmit the
101 request successfully. For example:
102
103 HTTP/1.1 428 Precondition Required
104 Content-Type: text/html
105
106
107
108 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 2]</span></pre>
109 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
110 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
111
112
113 &lt;html&gt;
114 &lt;head&gt;
115 &lt;title&gt;Precondition Required&lt;/title&gt;
116 &lt;/head&gt;
117 &lt;body&gt;
118 &lt;h1&gt;Precondition Required&lt;/h1&gt;
119 &lt;p&gt;This request is required to be conditional;
120 try using "If-Match".&lt;/p&gt;
121 &lt;/body&gt;
122 &lt;/html&gt;
123
124 Responses with the 428 status code MUST NOT be stored by a cache.
125
126 <span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. 429 Too Many Requests</span>
127
128 The 429 status code indicates that the user has sent too many
129 requests in a given amount of time ("rate limiting").
130
131 The response representations SHOULD include details explaining the
132 condition, and MAY include a Retry-After header indicating how long
133 to wait before making a new request.
134
135 For example:
136
137 HTTP/1.1 429 Too Many Requests
138 Content-Type: text/html
139 Retry-After: 3600
140
141 &lt;html&gt;
142 &lt;head&gt;
143 &lt;title&gt;Too Many Requests&lt;/title&gt;
144 &lt;/head&gt;
145 &lt;body&gt;
146 &lt;h1&gt;Too Many Requests&lt;/h1&gt;
147 &lt;p&gt;I only allow 50 requests per hour to this Web site per
148 logged in user. Try again soon.&lt;/p&gt;
149 &lt;/body&gt;
150 &lt;/html&gt;
151
152 Note that this specification does not define how the origin server
153 identifies the user, nor how it counts requests. For example, an
154 origin server that is limiting request rates can do so based upon
155 counts of requests on a per-resource basis, across the entire server,
156 or even among a set of servers. Likewise, it might identify the user
157 by its authentication credentials, or a stateful cookie.
158
159 Responses with the 429 status code MUST NOT be stored by a cache.
160
161
162
163
164 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 3]</span></pre>
165 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
166 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
167
168
169 <span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. 431 Request Header Fields Too Large</span>
170
171 The 431 status code indicates that the server is unwilling to process
172 the request because its header fields are too large. The request MAY
173 be resubmitted after reducing the size of the request header fields.
174
175 It can be used both when the set of request header fields in total is
176 too large, and when a single header field is at fault. In the latter
177 case, the response representation SHOULD specify which header field
178 was too large.
179
180 For example:
181
182 HTTP/1.1 431 Request Header Fields Too Large
183 Content-Type: text/html
184
185 &lt;html&gt;
186 &lt;head&gt;
187 &lt;title&gt;Request Header Fields Too Large&lt;/title&gt;
188 &lt;/head&gt;
189 &lt;body&gt;
190 &lt;h1&gt;Request Header Fields Too Large&lt;/h1&gt;
191 &lt;p&gt;The "Example" header was too large.&lt;/p&gt;
192 &lt;/body&gt;
193 &lt;/html&gt;
194
195 Responses with the 431 status code MUST NOT be stored by a cache.
196
197 <span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. 511 Network Authentication Required</span>
198
199 The 511 status code indicates that the client needs to authenticate
200 to gain network access.
201
202 The response representation SHOULD contain a link to a resource that
203 allows the user to submit credentials (e.g., with an HTML form).
204
205 Note that the 511 response SHOULD NOT contain a challenge or the
206 login interface itself, because browsers would show the login
207 interface as being associated with the originally requested URL,
208 which may cause confusion.
209
210 The 511 status SHOULD NOT be generated by origin servers; it is
211 intended for use by intercepting proxies that are interposed as a
212 means of controlling access to the network.
213
214 Responses with the 511 status code MUST NOT be stored by a cache.
215
216
217
218
219
220 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 4]</span></pre>
221 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
222 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
223
224
225 <span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>. The 511 Status Code and Captive Portals</span>
226
227 The 511 status code is designed to mitigate problems caused by
228 "captive portals" to software (especially non-browser agents) that is
229 expecting a response from the server that a request was made to, not
230 the intervening network infrastructure. It is not intended to
231 encourage deployment of captive portals -- only to limit the damage
232 caused by them.
233
234 A network operator wishing to require some authentication, acceptance
235 of terms, or other user interaction before granting access usually
236 does so by identifying clients who have not done so ("unknown
237 clients") using their Media Access Control (MAC) addresses.
238
239 Unknown clients then have all traffic blocked, except for that on TCP
240 port 80, which is sent to an HTTP server (the "login server")
241 dedicated to "logging in" unknown clients, and of course traffic to
242 the login server itself.
243
244 For example, a user agent might connect to a network and make the
245 following HTTP request on TCP port 80:
246
247 GET /index.htm HTTP/1.1
248 Host: www.example.com
249
250 Upon receiving such a request, the login server would generate a 511
251 response:
252
253 HTTP/1.1 511 Network Authentication Required
254 Content-Type: text/html
255
256 &lt;html&gt;
257 &lt;head&gt;
258 &lt;title&gt;Network Authentication Required&lt;/title&gt;
259 &lt;meta http-equiv="refresh"
260 content="0; url=https://login.example.net/"&gt;
261 &lt;/head&gt;
262 &lt;body&gt;
263 &lt;p&gt;You need to &lt;a href="https://login.example.net/"&gt;
264 authenticate with the local network&lt;/a&gt; in order to gain
265 access.&lt;/p&gt;
266 &lt;/body&gt;
267 &lt;/html&gt;
268
269 Here, the 511 status code assures that non-browser clients will not
270 interpret the response as being from the origin server, and the META
271 HTML element redirects the user agent to the login server.
272
273
274
275
276 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 5]</span></pre>
277 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
278 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
279
280
281 <span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Security Considerations</span>
282
283 <span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. 428 Precondition Required</span>
284
285 The 428 status code is optional; clients cannot rely upon its use to
286 prevent "lost update" conflicts.
287
288 <span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. 429 Too Many Requests</span>
289
290 When a server is under attack or just receiving a very large number
291 of requests from a single party, responding to each with a 429 status
292 code will consume resources.
293
294 Therefore, servers are not required to use the 429 status code; when
295 limiting resource usage, it may be more appropriate to just drop
296 connections, or take other steps.
297
298 <span class="h3"><a class="selflink" id="section-7.3" href="#section-7.3">7.3</a>. 431 Request Header Fields Too Large</span>
299
300 Servers are not required to use the 431 status code; when under
301 attack, it may be more appropriate to just drop connections, or take
302 other steps.
303
304 <span class="h3"><a class="selflink" id="section-7.4" href="#section-7.4">7.4</a>. 511 Network Authentication Required</span>
305
306 In common use, a response carrying the 511 status code will not come
307 from the origin server indicated in the request's URL. This presents
308 many security issues; e.g., an attacking intermediary may be
309 inserting cookies into the original domain's name space, may be
310 observing cookies or HTTP authentication credentials sent from the
311 user agent, and so on.
312
313 However, these risks are not unique to the 511 status code; in other
314 words, a captive portal that is not using this status code introduces
315 the same issues.
316
317 Also, note that captive portals using this status code on a Secure
318 Socket Layer (SSL) or Transport Layer Security (TLS) connection
319 (commonly, port 443) will generate a certificate error on the client.
320
321
322
323
324
325
326
327
328
329
330
331
332 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 6]</span></pre>
333 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
334 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
335
336
337 <span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. IANA Considerations</span>
338
339 The HTTP Status Codes registry has been updated with the following
340 entries:
341
342 Value: 428
343 Description: Precondition Required
344 Reference: [<a href="./rfc6585">RFC6585</a>]
345
346 Value: 429
347 Description: Too Many Requests
348 Reference: [<a href="./rfc6585">RFC6585</a>]
349
350 Value: 431
351 Description: Request Header Fields Too Large
352 Reference: [<a href="./rfc6585">RFC6585</a>]
353
354 Value: 511
355 Description: Network Authentication Required
356 Reference: [<a href="./rfc6585">RFC6585</a>]
357
358 <span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. References</span>
359
360 <span class="h3"><a class="selflink" id="section-9.1" href="#section-9.1">9.1</a>. Normative References</span>
361
362 [<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
363 Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
364
365 [<a id="ref-RFC2616">RFC2616</a>] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
366 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
367 Transfer Protocol -- HTTP/1.1", <a href="./rfc2616">RFC 2616</a>, June 1999.
368
369 <span class="h3"><a class="selflink" id="section-9.2" href="#section-9.2">9.2</a>. Informative References</span>
370
371 [<a id="ref-CORS">CORS</a>] van Kesteren, A., Ed., "Cross-Origin Resource Sharing",
372 W3C Working Draft WD-cors-20100727, July 2010,
373 &lt;<a href="http://www.w3.org/TR/cors/">http://www.w3.org/TR/cors/</a>&gt;.
374
375 [<a id="ref-Favicon">Favicon</a>] Wikipedia, "Favicon", March 2012,
376 &lt;<a href="http://en.wikipedia.org/w/index.php?title=Favicon&amp;oldid=484627550">http://en.wikipedia.org/w/</a>
377 <a href="http://en.wikipedia.org/w/index.php?title=Favicon&amp;oldid=484627550">index.php?title=Favicon&amp;oldid=484627550</a>&gt;.
378
379 [<a id="ref-OAuth2.0">OAuth2.0</a>] Hammer-Lahav, E., Ed., Recordon, D., and D. Hardt, "The
380 OAuth 2.0 Authorization Protocol", Work in Progress,
381 March 2012.
382
383
384
385
386
387
388 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 7]</span></pre>
389 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
390 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
391
392
393 [<a id="ref-P3P">P3P</a>] Marchiori, M., Ed., "The Platform for Privacy Preferences
394 1.0 (P3P1.0) Specification", W3C Recommendation
395 REC-P3P-20020416, April 2002,
396 &lt;<a href="http://www.w3.org/TR/P3P/">http://www.w3.org/TR/P3P/</a>&gt;.
397
398 [<a id="ref-RFC4791">RFC4791</a>] Daboo, C., Desruisseaux, B., and L. Dusseault,
399 "Calendaring Extensions to WebDAV (CalDAV)", <a href="./rfc4791">RFC 4791</a>,
400 March 2007.
401
402 [<a id="ref-RFC4918">RFC4918</a>] Dusseault, L., Ed., "HTTP Extensions for Web Distributed
403 Authoring and Versioning (WebDAV)", <a href="./rfc4918">RFC 4918</a>, June 2007.
404
405 [<a id="ref-WIDGETS">WIDGETS</a>] Caceres, M., Ed., "Widget Packaging and XML
406 Configuration", W3C Recommendation REC-widgets-20110927,
407 September 2011, &lt;<a href="http://www.w3.org/TR/widgets/">http://www.w3.org/TR/widgets/</a>&gt;.
408
409 [<a id="ref-WebFinger">WebFinger</a>] WebFinger Project, "WebFingerProtocol (Draft)",
410 January 2010, &lt;<a href="http://code.google.com/p/webfinger/wiki/WebFingerProtocol">http://code.google.com/p/webfinger/wiki/</a>
411 <a href="http://code.google.com/p/webfinger/wiki/WebFingerProtocol">WebFingerProtocol</a>&gt;.
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 8]</span></pre>
445 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
446 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
447
448
449 <span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>. Acknowledgements</span>
450
451 Thanks to Jan Algermissen and Julian Reschke for their suggestions
452 and feedback.
453
454 <span class="h2"><a class="selflink" id="appendix-B" href="#appendix-B">Appendix B</a>. Issues Raised by Captive Portals</span>
455
456 Since clients cannot differentiate between a portal's response and
457 that of the HTTP server that they intended to communicate with, a
458 number of issues arise. The 511 status code is intended to help
459 mitigate some of them.
460
461 One example is the "favicon.ico" [<a href="#ref-Favicon" title="&quot;Favicon&quot;">Favicon</a>] commonly used by browsers
462 to identify the site being accessed. If the favicon for a given site
463 is fetched from a captive portal instead of the intended site (e.g.,
464 because the user is unauthenticated), it will often "stick" in the
465 browser's cache (most implementations cache favicons aggressively)
466 beyond the portal session, so that it seems as if the portal's
467 favicon has "taken over" the legitimate site.
468
469 Another browser-based issue comes about when the Platform for Privacy
470 Preferences [<a href="#ref-P3P" title="&quot;The Platform for Privacy Preferences 1.0 (P3P1.0) Specification&quot;">P3P</a>] is supported. Depending on how it is implemented,
471 it's possible a browser might interpret a portal's response for the
472 p3p.xml file as the server's, resulting in the privacy policy (or
473 lack thereof) advertised by the portal being interpreted as applying
474 to the intended site. Other Web-based protocols such as WebFinger
475 [<a href="#ref-WebFinger" title="&quot;WebFingerProtocol (Draft)&quot;">WebFinger</a>], Cross-Origin Resource Sharing [<a href="#ref-CORS" title="&quot;Cross-Origin Resource Sharing&quot;">CORS</a>], and Open
476 Authorization [<a href="#ref-OAuth2.0" title="&quot;The OAuth 2.0 Authorization Protocol&quot;">OAuth2.0</a>] may also be vulnerable to such issues.
477
478 Although HTTP is most widely used with Web browsers, a growing number
479 of non-browsing applications use it as a substrate protocol. For
480 example, Web Distributed Authoring and Versioning (WebDAV) [<a href="./rfc4918" title="&quot;HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV)&quot;">RFC4918</a>]
481 and Calendaring Extensions to WebDAV (CalDAV) [<a href="./rfc4791" title="&quot;Calendaring Extensions to WebDAV (CalDAV)&quot;">RFC4791</a>] both use HTTP
482 as the basis (for remote authoring and calendaring, respectively).
483 Using these applications from behind a captive portal can result in
484 spurious errors being presented to the user, and might result in
485 content corruption, in extreme cases.
486
487 Similarly, other non-browser applications using HTTP can be affected
488 as well, e.g., widgets [<a href="#ref-WIDGETS" title="&quot;Widget Packaging and XML Configuration&quot;">WIDGETS</a>], software updates, and other
489 specialized software such as Twitter clients and the iTunes Music
490 Store.
491
492 It should be noted that it's sometimes believed that using HTTP
493 redirection to direct traffic to the portal addresses these issues.
494 However, since many of these uses "follow" redirects, this is not a
495 good solution.
496
497
498
499
500 <span class="grey">Nottingham &amp; Fielding Standards Track [Page 9]</span></pre>
501 <hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
502 <span class="grey"><a href="./rfc6585">RFC 6585</a> Additional HTTP Status Codes April 2012</span>
503
504
505 Authors' Addresses
506
507 Mark Nottingham
508 Rackspace
509
510 EMail: [email protected]
511 URI: <a href="http://www.mnot.net/">http://www.mnot.net/</a>
512
513
514 Roy T. Fielding
515 Adobe Systems Incorporated
516 345 Park Ave.
517 San Jose, CA 95110
518 USA
519
520 EMail: [email protected]
521 URI: <a href="http://roy.gbiv.com/">http://roy.gbiv.com/</a>
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556 Nottingham &amp; Fielding Standards Track [Page 10]
557 </pre>