Repository navigation
Expose Retry-After to cross-origin browser clients - #20548
Open
AyeshaWaseemAhmad wants to merge 2 commits into
Open
AyeshaWaseemAhmad wants to merge 2 commits into
AyeshaWaseemAhmad wants to merge 2 commits into
Conversation
`set_cors_headers` listed only `Synapse-Trace-Id`, `Server` and (on the
rendezvous endpoints) `ETag` in `Access-Control-Expose-Headers`. Synapse
sends `Retry-After` on 429 `M_LIMIT_EXCEEDED` responses, but a browser
client on another origin could not read it through
`response.headers.get("Retry-After")`.
Add `Retry-After` to both branches so such clients can honour the
delay. The Matrix spec says homeservers SHOULD send this header, and the
`retry_after_ms` body field is deprecated.
Fixes element-hq#20542
AyeshaWaseemAhmad
requested review from
devonh
and removed request for
a team
November 21, 2026 17:53
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
set_cors_headersonly listedSynapse-Trace-Id,Serverand, on the rendezvous endpoints,ETaginAccess-Control-Expose-Headers. Synapse sendsRetry-Afteron 429M_LIMIT_EXCEEDEDresponses, so a browser client on another origin gotnullfromresponse.headers.get("Retry-After").This adds
Retry-Afterto both branches. Since Matrix v1.10 homeservers SHOULD send the header, and theretry_after_msbody field is deprecated.Tests: a 429 raised through
JsonResourcenow hasRetry-Afterin the expose list, the rendezvous branch gets its own OPTIONS test, and the existingOptionsResourceTestsexpectation is updated. Not covered: the appservice proxy, which copies an upstream'sAccess-Control-Expose-Headersover ours.Fixes #20542
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.