Skip to content

Feature - temporary urls - #168

Merged
xavierlacot merged 13 commits into
mainfrom
feature/temporary-urls
Oct 5, 2026
Merged

xavierlacot merged 13 commits into
mainfrom
feature/temporary-urls

Conversation

@xavierlacot

Copy link
Copy Markdown
Member

fix #75
Co-authored with @rvanlaak, supersedes #72 and #79

Add native temporary (pre-signed) URL generation for medias and their variations, so applications backed by an S3-compatible bucket can serve files directly instead of proxying them through PHP.

A new getTemporaryUrl() method is available on Media, MediaVariation and both storages, signing the actual storage path with a configurable expiration.

The bundle also stops forcing a public visibility when writing files, so the visibility configured on the Flysystem storage now applies, which is required for private buckets.

@rvanlaak

Copy link
Copy Markdown
Contributor

This is great! I'll try verifying it asap, and whether my custom path replacement normalizer can be removed when this PR ships.

@damienalexandre

Copy link
Copy Markdown
Member

@rvanlaak Hello! 👋 Have you been able to test the feature?

@rvanlaak

Copy link
Copy Markdown
Contributor

Not yet. Can verify it Tomorrow.

@xavierlacot
xavierlacot force-pushed the feature/temporary-urls branch from 5813a41 to cf7eaf4 Compare September 25, 2026 11:59
@xavierlacot
xavierlacot force-pushed the feature/temporary-urls branch from cf7eaf4 to 13650c5 Compare September 30, 2026 14:19
@xavierlacot

Copy link
Copy Markdown
Member Author

Hi @rvanlaak, I rebased this PR on main and added a few things on top.

Variation existence is now cached once a file is known to be stored, so signing the URL of an existing variation no longer sends a HEAD request to the bucket on every call, which should address the slowness you noticed on your GET endpoints.

Also:

  • NullMedia::getTemporaryUrl() now throws like getUrl() does
  • the signed path ignores url_generator.path, so the normalizer rewriting your paths should no longer be needed
  • Temporary URLs are also covered by a new test suite running against an S3-compatible server

Except if you have a negative feedback on this PR, I am going to merge it by the end of the week.

@rvanlaak

rvanlaak commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Marked a block in my calendar for tomorrow afternoon. If I can't make it to provide feedback by eod I will also let you know.

@rvanlaak

rvanlaak commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Hi @xavierlacot , I've checked out and tested locally, and can confirm that all works as expected. It will allow me to remove little pieces of my custom code, especially the part related to what you're mentioning about the HEAD calls to the S3 buckets.

A big part of it is related to my custom normalizers, but that code is unrelated to this PR and I'll try drafting another PR for this repo to get that part rolling too.

@xavierlacot
xavierlacot merged commit 09d1a4b into main Oct 5, 2026
10 checks passed
@xavierlacot
xavierlacot deleted the feature/temporary-urls branch October 5, 2026 12:46
@xavierlacot

Copy link
Copy Markdown
Member Author

Alright then, thanks for the feedback and your contributions :-)

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.

Temporary URL generation support

3 participants