rfc-8516

"Too Many Requests" Response Code for the Constrained Application Protocol

A. Keranen
date2019-01 streamIETF areawit wgcore statusPROPOSED STANDARD pages6 canonicalhttps://www.rfc-editor.org/rfc/rfc8516 doi10.17487/RFC8516
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.

Extracted elements (14)

design-rationale §1

Request similarity for back-off purposes is defined as same method and Request-URI, but application logic may treat a sequence of requests with different URIs as similar if they form a series. Similarity is intentionally context-dependent and left to application logic.

congestion

design-rationale §1

The 4.29 code is distinct from 5.03 'Service Unavailable': 5.03 indicates general server overload (used for clients not causing the overload), while 4.29 specifically signals that the requesting client's high request rate is the cause of the problem.

congestion

interoperability-note §4

A client may receive a 4.29 response on a first request if a proxy on the path aggregates load from multiple clients and the server responds based on aggregate load, or if the client restarted and does not remember recent requests.

congestion

interoperability-note §4

Clients 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 to any requests at all.

congestion

interoperability-note §1

The 4.29 response code is modeled after HTTP 429 'Too Many Requests' (RFC 6585) and reuses CoAP's existing Max-Age option (RFC 7252 Section 5.10.5) for the retry back-off interval.

http, congestion

normative-requirement §4 SHOULD NOT

If a client receives a 4.29 response, it SHOULD NOT send a similar request to the server before the time indicated in the Max-Age option has passed. If no Max-Age option is present, the default value of 60 seconds applies.

congestion

normative-requirement §3 MAY

If a client repeats a request answered with 4.29 before Max-Age time has elapsed, the server MAY respond with a more generic error code (e.g., 5.03) to slow down clients that do not recognize the 4.29 code.

congestion

normative-requirement §3 SHOULD

If a CoAP server is unable to serve a client sending requests more often than it can handle, the server SHOULD respond with response code 4.29 'Too Many Requests'. The Max-Age option indicates the number of seconds after which the server assumes the client may retry.

congestion

normative-requirement §3 SHOULD

The server SHOULD rate-limit 4.29 replies taking into account its usual load-shedding policies, though any method that adds per-client state to the server may be counterproductive.

congestion

protocol-element §1

CoAP response code 4.29 'Too Many Requests' is defined for a server to signal that a client is sending requests more frequently than the server is capable or willing to handle. It uses the Max-Age option to indicate the back-off period after which the client may retry.

http, congestion

registry §6

IANA registered response code 4.29 'Too Many Requests' in the 'CoAP Response Codes' subregistry within the 'Constrained RESTful Environments (CoRE) Parameters' registry. RFC 8516 was also added as an additional reference for the Max-Age option in the 'CoAP Option Numbers' subregistry.

registry

security-consideration §5

A client should trust the 4.29 response code only to the extent that it trusts the underlying security mechanisms (e.g., DTLS) for authentication and freshness. An unauthenticated 4.29 response can be spoofed by an attacker to force the client to wait an extended period before retrying.

security, congestion

security-consideration §5

For a server under attack, it may be more appropriate to drop requests without responding rather than sending 4.29, since replying consumes server resources; however, dropping requests may cause well-behaving clients to simply retry.

security, congestion

security-consideration §5

If the 4.29 response code is sent without encryption, it may leak information about the server's overload situation and client traffic patterns.

security, privacy