matrix-org / matrix-spec

The Matrix protocol specification
Apache License 2.0
188 stars 94 forks source link

Rate-limiting behaviour is not well-defined for clients in the Client-Server API #1889

Open reivilibre opened 3 months ago

reivilibre commented 3 months ago

Link to problem area: https://spec.matrix.org/v1.11/client-server-api/#rate-limiting

Example real-world case where this matters is that matrix.org's Synapse converts 503s to 429s to avoid cloudflare taking the whole system down. These 429s don't have a retry-after time and they have an M_UNKNOWN error code.

Is this dodgy? Should clients be ready to handle this? The spec only makes some suggestions with SHOULD but doesn't clarify for servers or clients what is allowed and what isn't.

It is worth remembering that middleboxes, not understanding Matrix, may have reason to inject 429 response codes.