Closed corporealfunk closed 3 years ago
I've been testing this and it looks like the issue in rails/rails#31325 is solved in Rails 6 or 6.1. That means we can probably use the rails_blob_url
and rails_representation_url
helpers. I'll create a PR!
Created a PR #667
In Rails 6.1, we can set a configuration option like so in application or environment config files:
Spina's Content Presenter uses the rails_blob_representation_url which always routes to the redirect controller.
https://github.com/SpinaCMS/Spina/blob/b1f6fbef280170c6e7043954f85d89798c8c2dcd/app/presenters/spina/content_presenter.rb#L45
Leveraging Rail's image_tag helper would probably be easiest since it respects the proxy configuration directive, but Rails seems to have a problem with that with mounted Engines (https://github.com/rails/rails/issues/31325).
I'm not sure if Active Storage provides a more generic url_helper for blobs that would respect the configuration. A simple "rails routes | grep active_storage" doesn't seem to offer any. There is some discussion of a slightly related issue here: https://github.com/rails/rails/issues/41172