Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC3860: Media Download Redirects #3860

Merged
merged 16 commits into from
May 9, 2023
Merged
20 changes: 20 additions & 0 deletions proposals/3860-media-download-redirect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# MSC3860: Media Download Redirects
Fizzadar marked this conversation as resolved.
Show resolved Hide resolved
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved

Currently the media download endpoints must return either a 200 with content or error responses. This
means the media server instance must stream the data from wherever it is stored, which is likely not
local to itself. Allowing redirects on these endpoints would make it possible for the media repo to
tell clients/servers to pull data direct from the source, eg. a CDN.

## Proposal

This MSC simply proposes that a 307 redirect code is allowed and followed according to the `Location`
header. It is possible some clients would already follow these which needs to be confirmed. Specifc
endpoints in question:

+ `/_matrix/media/v3/download/{serverName}/{mediaId}`
+ `/_matrix/media/v3/download/{serverName}/{mediaId}/{fileName}`
+ `/_matrix/media/v3/thumbnail/{serverName}/{mediaId}`
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved

The media repo already conforms to standard HTTP practices so this may already work as expected. The
MSC is proposing to add redirects to the list of possible HTTP responses for the above endpoints in
the Matrix Specifiction. Implementation would be confirming that this works in all the major clients.