Skip to content

Commit 31e5fae

Browse files
authored
Merge pull request #147 from ietf-wg-httpapi/problem-types
Initial draft of Problem-types
2 parents 7b5749b + 301e082 commit 31e5fae

File tree

1 file changed

+98
-3
lines changed

1 file changed

+98
-3
lines changed

draft-ietf-httpapi-ratelimit-headers.md

Lines changed: 98 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ entity:
4444
normative:
4545
IANA: RFC8126
4646
HTTP: RFC9110
47+
PROBLEM: RFC9457
4748

4849
informative:
4950
PRIVACY: RFC6973
@@ -105,6 +106,8 @@ The term Origin is to be interpreted as described in Section 7 of{{!WEB-ORIGIN=R
105106

106107
This document uses the terms List, Item and Integer from {{Section 3 of !STRUCTURED-FIELDS=RFC8941}} to specify syntax and parsing, along with the concept of "bare item".
107108

109+
The term "problem type" in this document is to be interpreted as described in [PROBLEM].
110+
108111
# Terminology
109112

110113
Quota:
@@ -294,6 +297,53 @@ This example shows a 300MB remaining quota for an application in the next 60 sec
294297
RateLimit: "default";r=300000000;t=60;pk=:QXBwLTk5OQ==:
295298
~~~
296299

300+
# Problem Types {#problem-types}
301+
302+
## Quota Exceeded
303+
304+
This section defines the "https://iana.org/assignments/http-problem-types#quota-exceeded" problem type. A server MAY use this problem type if it wants to communicate to the client that the requests sent by the client exceed one or more Quota Policies. This problem type defines the extension member "violated-policies" as an array of strings, whose value is the names of policies where the quota was exceeded.
305+
306+
~~~ http-message
307+
HTTP/1.1 429 Bad Request
308+
Content-Type: application/problem+json
309+
310+
{
311+
"type": "https://iana.org/assignments/http-problem-types#quota-exceeded",
312+
"title": "Request cannot be satisifed as assigned quota has been exceeded",
313+
"violated-policies": ["daily","bandwidth"]
314+
}
315+
~~~
316+
317+
## Temporary Reduced Capacity
318+
319+
This section defines the "https://iana.org/assignments/http-problem-types#temporary-reduced-capacity" problem type. A server MAY use this problem type if it wants to communicate to the client that the requests sent by the client exceed cannot currently be satisfied due to a temporary reduction in capacity due to service limitations. The server MAY chose to include a RateLimit-Policy field indicating the new temporarily lower quota. This problem type defines the extension member "violated-policies" as an array of strings, whose value is the names of policies where the quota was exceeded.
320+
321+
~~~ http-message
322+
HTTP/1.1 503 Server Unavailable
323+
Content-Type: application/problem+json
324+
325+
{
326+
"type": "https://iana.org/assignments/http-problem-types#temporary-reduced-capacity",
327+
"title": "Request cannot be satisifed due to temporary server capacity constraints",
328+
"violated-policies": ["hourly"]
329+
}
330+
~~~
331+
332+
## Abnormal Usage Detected
333+
334+
This section defines the "https://iana.org/assignments/http-problem-types#abnormal-usage-detected" problem type. A server MAY use this problem type to communicate to the client that it has detected a pattern of requests that suggest unintentional or malicous behaviour on the part of the client. This problem type defines the extension member "violated-policies" as an array of strings, whose value is the names of policies where the quota was exceeded.
335+
336+
~~~ http-message
337+
HTTP/1.1 429 Too Many Requests
338+
Content-Type: application/problem+json
339+
340+
{
341+
"type": "https://iana.org/assignments/http-problem-types#abnormal-usage-detected",
342+
"title": "Request not satisifed due to detection of abnormal request pattern",
343+
"violated-policies": ["hourly"]
344+
}
345+
~~~
346+
297347

298348
# Server Behavior {#providing-ratelimit-fields}
299349

@@ -503,7 +553,9 @@ can define specific techniques to mitigate the risks of re-identification.
503553

504554
# IANA Considerations
505555

506-
IANA is requested to update one registry and create one new registry.
556+
IANA is requested to update two registries and create one new registry.
557+
558+
## Update HTTP Field Name Registry
507559

508560
Please add the following entries to the
509561
"Hypertext Transfer Protocol (HTTP) Field Name Registry" registry ({{HTTP}}):
@@ -515,6 +567,42 @@ Please add the following entries to the
515567
| RateLimit-Policy | permanent | {{ratelimit-policy-field}} of {{&SELF}} |
516568
|---------------------|-----------|---------------|
517569

570+
571+
## Update HTTP Problem Type registry
572+
573+
IANA is asked to register the following entries in the "HTTP Problem Types" registry at https://www.iana.org/assignments/http-problem-types.
574+
575+
### Registration of "quota-exceeded" Problem Type
576+
577+
Type URI: https://iana.org/assignments/http-problem-types#quota-exceeded
578+
579+
Title: Quota Exceeded
580+
581+
Recommended HTTP status code: 429
582+
583+
Reference: {{quota-exceeded}} of this document
584+
585+
### Registration of "temporary-reduced-capacity" Problem Type
586+
587+
Type URI: https://iana.org/assignments/http-problem-types#temporary-reduced-capacity
588+
589+
Title: Temporary Reduced Capacity
590+
591+
Recommended HTTP status code: 503
592+
593+
Reference: {{temporary-reduced-capacity}} of this document
594+
595+
### Registration of "abnormal-usage-detected" Problem Type
596+
597+
Type URI: https://iana.org/assignments/http-problem-types#abnormal-usage-detected
598+
599+
Title: Abnormal Usage Detected
600+
601+
Recommended HTTP status code: 429
602+
603+
Reference: {{abnormal-usage-detected}} of this document
604+
605+
518606
## RateLimit quota unit registry {#ratelimit-quota-unit-registry}
519607

520608
This specification establishes the registry "Hypertext Transfer Protocol (HTTP) RateLimit Quota Units" registry to be located at https://www.iana.org/assignments/http-ratelimit-quota-units. Registration is done on the advice of a Designated Expert, appointed by the IESG or their delegate. All entries are Specification Required ([IANA], Section 4.6).
@@ -750,15 +838,16 @@ Response:
750838

751839
~~~ http-message
752840
HTTP/1.1 429 Too Many Requests
753-
Content-Type: application/json
841+
Content-Type: application/problem+json
754842
Date: Mon, 05 Aug 2019 09:27:00 GMT
755843
Retry-After: Mon, 05 Aug 2019 09:27:05 GMT
756844
RateLimit: "default";r=0;t=5
757845

758846
{
847+
"type": "https://iana.org/assignments/http-problem-types#quota-exceeded"
759848
"title": "Too Many Requests",
760849
"status": 429,
761-
"detail": "You have exceeded your quota"
850+
"policy-violations": ["default"]
762851
}
763852
~~~
764853

@@ -1163,6 +1252,12 @@ and Julian Reschke.
11631252
# Changes
11641253
{:numbered="false" removeinrfc="true"}
11651254

1255+
## Since draft-ietf-httpapi-ratelimit-headers-08
1256+
{:numbered="false" removeinrfc="true"}
1257+
1258+
* Added Problem Types
1259+
* Clarified when to use RateLimit-Policy vs RateLimit fields
1260+
11661261
## Since draft-ietf-httpapi-ratelimit-headers-07
11671262
{:numbered="false" removeinrfc="true"}
11681263

0 commit comments

Comments
 (0)