You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This gem looks spiffy and I was really excited to try it. I plugged it into the site that I was working on and found that it broke a bunch of links to user-uploaded content. I use ActiveStorage with S3 and images were showing up as broken links.
After poking around, I figured out that Active Storage was generating some redirect URLS under the hood to display the blobs and Lockup was hijacking those redirects with the Code page.
I ended up copying the ActiveStorage controller and modifying it slightly to include the skip_before_action that was not being inherited from the ApplicationController.
class ActiveStorage::Blobs::RedirectController < ActiveStorage::BaseController
skip_before_action :check_for_lockup, raise: false
include ActiveStorage::SetBlob
def show
expires_in ActiveStorage.service_urls_expire_in
redirect_to @blob.url(disposition: params[:disposition]), allow_other_host: true
end
end
You can see the original source of the ActiveStorage controller here.
Not sure there's anything to do here, but I felt like I may as well document my findings and maybe save someone a few hours. Feel free to close this issue if there's no action items. Thanks!
Edit: Actually, this didn't fix things much either. Making the changes above fixed uploading images but broke the displaying of images hosted through ActiveRecord's S3 integration. I guess extending the ActiveStorage controllers is not quite as easy as other controllers are. This gentleman has a proposal where he mentions that you either have to copy the routes from ActiveStorage into your routes.rb file, or use custom route helpers and lose the fancy helpers that ActiveStorage provides. I tried a few different combinations of that and couldn't get things to work. Going to have to put Lockup on the shelf until I can spend more time trying to get things working together.
The text was updated successfully, but these errors were encountered:
Hi all!
This gem looks spiffy and I was really excited to try it. I plugged it into the site that I was working on and found that it broke a bunch of links to user-uploaded content. I use ActiveStorage with S3 and images were showing up as broken links.
After poking around, I figured out that Active Storage was generating some redirect URLS under the hood to display the blobs and Lockup was hijacking those redirects with the Code page.
I ended up copying the ActiveStorage controller and modifying it slightly to include the
skip_before_action
that was not being inherited from the ApplicationController.app/controllers/active_storage/blobs/redirect_controller.rb
You can see the original source of the ActiveStorage controller here.
Not sure there's anything to do here, but I felt like I may as well document my findings and maybe save someone a few hours. Feel free to close this issue if there's no action items. Thanks!
Edit: Actually, this didn't fix things much either. Making the changes above fixed uploading images but broke the displaying of images hosted through ActiveRecord's S3 integration. I guess extending the ActiveStorage controllers is not quite as easy as other controllers are. This gentleman has a proposal where he mentions that you either have to copy the routes from ActiveStorage into your routes.rb file, or use custom route helpers and lose the fancy helpers that ActiveStorage provides. I tried a few different combinations of that and couldn't get things to work. Going to have to put Lockup on the shelf until I can spend more time trying to get things working together.
The text was updated successfully, but these errors were encountered: