1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 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 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
|
<pre>Internet Engineering Task Force (IETF) A. Keranen
Request for Comments: 8516 Ericsson
Category: Standards Track January 2019
ISSN: 2070-1721
"Too Many Requests" Response Code for
the Constrained Application Protocol
Abstract
A Constrained Application Protocol (CoAP) server can experience
temporary overload because one or more clients are sending requests
to the server at a higher rate than the server is capable or willing
to handle. This document defines a new CoAP response code for a
server to indicate that a client should reduce the rate of requests.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc7841#section-2">Section 2 of RFC 7841</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="https://www.rfc-editor.org/info/rfc8516">https://www.rfc-editor.org/info/rfc8516</a>.
Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
<span class="grey">Keranen Standards Track [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc8516">RFC 8516</a> "Too Many Requests" Response Code for CoAP January 2019</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-2">2</a>. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-3">3</a>. CoAP Server Behavior . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-4">4</a>. CoAP Client Behavior . . . . . . . . . . . . . . . . . . . . <a href="#page-3">3</a>
<a href="#section-5">5</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-6">6</a>. IANA Considerations . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-7">7</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-7.1">7.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-7.2">7.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
The Constrained Application Protocol (CoAP) [<a href="./rfc7252" title=""The Constrained Application Protocol (CoAP)"">RFC7252</a>] response codes
are used by a CoAP server to indicate the result of an attempt to
understand and satisfy a request sent by a client.
CoAP response codes are similar to the HTTP [<a href="./rfc7230" title=""Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing"">RFC7230</a>] status codes,
and many codes are shared with similar semantics by both CoAP and
HTTP. HTTP has the code "429" registered for "Too Many Requests"
[<a href="./rfc6585" title=""Additional HTTP Status Codes"">RFC6585</a>]. This document registers a CoAP response code "4.29" for
similar purposes and uses the Max-Age option (see <a href="./rfc7252#section-5.10.5">Section 5.10.5 of
[RFC7252]</a>) to indicate a back-off period after which a client can try
the request again.
While a server may not be able to respond to one kind of request, it
may be able to respond to a request of a different kind, even from
the same client. Therefore, the back-off period applies only to
similar requests. For the purpose of this response code, a request
is similar if it has the same method and Request-URI. Also, if a
client is sending a sequence of requests that are part of the same
series (e.g., a set of measurements to be processed by the server),
they can be considered similar even if request URIs are different.
Because request similarity is context-dependent, it is up to the
application logic to decide how the similarity of the requests should
be evaluated.
The 4.29 code is similar to the 5.03 "Service Unavailable" [<a href="./rfc7252" title=""The Constrained Application Protocol (CoAP)"">RFC7252</a>]
code in that the 5.03 code can also be used by a server to signal an
overload situation. The 5.03 code also uses the Max-Age option to
indicate the time after which a client can retry. However, the 4.29
code indicates that the too-frequent requests from the requesting
client are the reason for the overload.
<span class="grey">Keranen Standards Track [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc8516">RFC 8516</a> "Too Many Requests" Response Code for CoAP January 2019</span>
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Terminology</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in
<a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a> [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>] [<a href="./rfc8174" title=""Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"">RFC8174</a>] when, and only when, they appear in all
capitals, as shown here.
Readers should also be familiar with the terms and concepts discussed
in [<a href="./rfc7252" title=""The Constrained Application Protocol (CoAP)"">RFC7252</a>].
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. CoAP Server Behavior</span>
If a CoAP server is unable to serve a client that is sending CoAP
request messages more often than the server is capable or willing to
handle, the server SHOULD respond to the request(s) with the response
code 4.29, "Too Many Requests". The Max-Age option is used to
indicate the number of seconds after which the server assumes it is
OK for the client to retry the request.
An action result payload (see <a href="./rfc7252#section-5.5.1">Section 5.5.1 of [RFC7252]</a>) can be sent
by the server to give more guidance to the client, e.g., details of
the overload situation.
The 4.29 response code is only returned to the client(s) sending
requests too frequently; if other clients are sending requests that
cannot be served due to server overload, the 5.03 response code is
more appropriate.
If a client repeats a request that was answered with 4.29 before
Max-Age time has passed, it is possible that the client sent multiple
requests before receiving the first answer or that the client did not
recognize the response code. To slow down clients that do not
recognize the 4.29 code, the server MAY respond with a more generic
error code (e.g., 5.03). The server SHOULD rate-limit 4.29 replies
taking into account its usual load-shedding policies. However, any
such method that adds per-client state to the server may be
counterproductive to reducing the load.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. CoAP Client Behavior</span>
If a client receives the 4.29 response code from a CoAP server to a
request, it SHOULD NOT send a similar request to the server before
the time indicated in the Max-Age option has passed. If the 4.29
response does not contain a Max-Age option, the default value (60
seconds, as defined in <a href="./rfc7252#section-5.10.5">Section 5.10.5 of [RFC7252]</a>) is assumed.
<span class="grey">Keranen Standards Track [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc8516">RFC 8516</a> "Too Many Requests" Response Code for CoAP January 2019</span>
Note that a client may receive a 4.29 response code on a first
request to a server. This can happen, for example, if there is a
proxy on the path and the server replies based on the load from
multiple clients aggregated by the proxy, or if a client has
restarted recently and does not remember its recent requests.
A client should not rely on a server being able to send the 4.29
response code in an overload situation because an overloaded server
may not be able to reply at all to some requests.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Security Considerations</span>
Security considerations of [<a href="./rfc7252" title=""The Constrained Application Protocol (CoAP)"">RFC7252</a>] apply to this response code
also.
Replying to CoAP requests with a response code consumes resources
from a server. For a server under attack, it may be more appropriate
to simply drop requests without responding at all. However, dropping
requests is also likely to cause well-behaving clients to simply
retry the requests.
As with any other CoAP reply, a client should trust this response
code only to the extent that it trusts the underlying security
mechanisms (e.g., DTLS [<a href="./rfc6347" title=""Datagram Transport Layer Security Version 1.2"">RFC6347</a>]) for authentication and freshness.
If a CoAP reply with the "Too Many Requests" response code is not
authenticated and integrity protected, an attacker can attempt to
spoof a reply and make the client wait for an extended period of time
before trying again.
If the response code is sent without encryption, it may leak
information about the server overload situation and client traffic
patterns.
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. IANA Considerations</span>
IANA has registered the following response code in the "CoAP Response
Codes" subregistry within the "Constrained RESTful Environments
(CoRE) Parameters" registry:
o Response Code: 4.29
o Description: Too Many Requests
o Reference: <a href="./rfc8516">RFC 8516</a>
IANA has added this document as an additional reference for the
Max-Age option in the "CoAP Option Numbers" subregistry.
<span class="grey">Keranen Standards Track [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc8516">RFC 8516</a> "Too Many Requests" Response Code for CoAP January 2019</span>
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. References</span>
<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>. Normative References</span>
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
DOI 10.17487/RFC2119, March 1997,
<<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>>.
[<a id="ref-RFC7252">RFC7252</a>] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained
Application Protocol (CoAP)", <a href="./rfc7252">RFC 7252</a>,
DOI 10.17487/RFC7252, June 2014,
<<a href="https://www.rfc-editor.org/info/rfc7252">https://www.rfc-editor.org/info/rfc7252</a>>.
[<a id="ref-RFC8174">RFC8174</a>] Leiba, B., "Ambiguity of Uppercase vs Lowercase in <a href="./rfc2119">RFC</a>
<a href="./rfc2119">2119</a> Key Words", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc8174">RFC 8174</a>, DOI 10.17487/RFC8174,
May 2017, <<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>>.
<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>. Informative References</span>
[<a id="ref-CoAP-BROKER">CoAP-BROKER</a>]
Koster, M., Keranen, A., and J. Jimenez, "Publish-
Subscribe Broker for the Constrained Application Protocol
(CoAP)", Work in Progress, <a href="./draft-ietf-core-coap-pubsub-06">draft-ietf-core-coap-pubsub-06</a>,
January 2019.
[<a id="ref-RFC6347">RFC6347</a>] Rescorla, E. and N. Modadugu, "Datagram Transport Layer
Security Version 1.2", <a href="./rfc6347">RFC 6347</a>, DOI 10.17487/RFC6347,
January 2012, <<a href="https://www.rfc-editor.org/info/rfc6347">https://www.rfc-editor.org/info/rfc6347</a>>.
[<a id="ref-RFC6585">RFC6585</a>] Nottingham, M. and R. Fielding, "Additional HTTP Status
Codes", <a href="./rfc6585">RFC 6585</a>, DOI 10.17487/RFC6585, April 2012,
<<a href="https://www.rfc-editor.org/info/rfc6585">https://www.rfc-editor.org/info/rfc6585</a>>.
[<a id="ref-RFC7230">RFC7230</a>] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer
Protocol (HTTP/1.1): Message Syntax and Routing",
<a href="./rfc7230">RFC 7230</a>, DOI 10.17487/RFC7230, June 2014,
<<a href="https://www.rfc-editor.org/info/rfc7230">https://www.rfc-editor.org/info/rfc7230</a>>.
<span class="grey">Keranen Standards Track [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc8516">RFC 8516</a> "Too Many Requests" Response Code for CoAP January 2019</span>
Acknowledgements
This response code definition was originally part of the "Publish-
Subscribe Broker for CoAP" document [<a href="#ref-CoAP-BROKER">CoAP-BROKER</a>]. The author would
like to thank Abhijan Bhattacharyya, Carsten Bormann, Daniel Migault,
Gyorgy Rethy, Jana Iyengar, Jim Schaad, Klaus Hartke, Mohit Sethi,
and Sandor Katona for their contributions and reviews.
Author's Address
Ari Keranen
Ericsson
Hirsalantie 11
02420 Jorvas
Finland
Email: ari.keranen@ericsson.com
Keranen Standards Track [Page 6]
</pre>
|