Define Default URL for ActiveStorage to fix Mixed Content Error

02-Dec-2022 940
Using ActiveStorage with external services like AWS S3 for saving and surfing attachments like images is great. The setup is well explained in Active Storage Overview in Ruby on Rails Guides.But if you start using it, you will maybe encounter some problems, which are not that easy to find or debug within production. One of the problems we encountered was a Mixed content related to ActiveStorage. This was not a big problem at first. But after we added an iOS App, which was using WkWebViews, some random redirects to AWS S3 images stopped working. We couldn't even see connections for these images to ActiveStorage in logs, which made it harder todebug.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle