|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
# MSC4041: Use http header Retry-After to enable library-assisted retry handling
|
|
|
|
|
|
|
|
|
|
The current Matrix Client-Server API (v1.7) recommends that home servers should protect themselves from
|
|
|
|
|
The current Matrix Client-Server API (v1.7) recommends that homeservers should protect themselves from
|
|
|
|
|
being overloaded by enforcing rate-limits to selected API calls.
|
|
|
|
|
If home servers limit access to an API they respond with an http error code 429 and a response body
|
|
|
|
|
If homeservers limit access to an API they respond with an http error code 429 and a response body
|
|
|
|
|
that includes a property `retry_after_ms` to indicate how long a client has to wait before retrying.
|
|
|
|
|
|
|
|
|
|
Some http libraries (like [Ky](https://github.com/sindresorhus/ky), [got](https://github.com/sindresorhus/got
|
|
|
|
@ -17,7 +17,7 @@ potential that current http libraries offer in terms of automated retry handling
|
|
|
|
|
## Proposal
|
|
|
|
|
|
|
|
|
|
In order to allow developers to make use of the automated retry handling capabilities of http libraries
|
|
|
|
|
home servers shall use the http header `Retry-After` in case they respond with an http error 429.
|
|
|
|
|
homeservers shall use the http header `Retry-After` in case they respond with an http error 429.
|
|
|
|
|
The value of `Retry-After` (in __seconds__) is meant to be a delay after receiving the response and must be
|
|
|
|
|
calculated in order to comply with the specification in [RFC 9119 - HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110#field.retry-after).
|
|
|
|
|
|
|
|
|
@ -25,7 +25,7 @@ With the introduction of the http header `Retry-After` the usage of the existing
|
|
|
|
|
|
|
|
|
|
## Potential issues
|
|
|
|
|
|
|
|
|
|
In order to maintain backward compatibility with existing client libraries home servers shall use both the `Retry-After` header and the
|
|
|
|
|
In order to maintain backward compatibility with existing client libraries homeservers shall use both the `Retry-After` header and the
|
|
|
|
|
`retry_after_ms` property in the response body.
|
|
|
|
|
|
|
|
|
|
Client libraries shall use the values in this order:
|
|
|
|
|