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

Add option to presign public S3 URL #623

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PseudoResonance
Copy link

This adds support for presigning public S3 URLs so that you can use the S3 redirect feature without having to make the entire bucket public. The expiry time is also configurable, between 1 minute (min for Amazon S3 I think?) and 7 days (max S3 value).

@PseudoResonance
Copy link
Author

One thing to note, with the current design, this makes the browser/client caching useless. Each time the user tries to download an image, the URL will change and they will download it again. This should probably not be used if you are being charged by bandwidth.
This can be resolved by caching the URLs on the server side and returning the same URL if it's still valid for a while. Perhaps a min expiry config can be added to invalidate and recreate URLs that will expire too soon.

@PseudoResonance
Copy link
Author

There we go. I'm not sure if there's any changes you'd like, but I tried to copy the existing media cache code, but modify it for URL caching instead. It feels a lot snappier to scroll up/down in Matrix now, because I don't need to constantly redownload everything, including the profile pictures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant