The ActiveStorage image_url
helper generates a URL to the image on the Rails web server. When that request is received on the web server it is redirected to a URL on Cloudinary to request the image. ActiveStorage is generating an image URL with the https protocol but the Rails web server is generating an image URL to Cloudinary with the http (no ssl) protocol. I have not been able to determine why.
The Log of the request:
Started GET "/rails/active_storage/blobs/really_long_hash/user-2.png"
Processing by ActiveStorage::BlobsController#show as JPEG
Parameters: {"signed_id"=>"really_long_hash", "filename"=>"nsi-site-bg"}
ActiveStorage::Blob Load (0.8ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", 48], ["LIMIT", 1]]
Cloudinary Storage (4.3ms) Generated URL for file at key: cloudinary_file_name (http://res-4.cloudinary.com/hcfhlrdjg/image/upload/cloudinary_file_name.jpg)
Redirected to http://res-4.cloudinary.com/hcfhlrdjg/image/upload/cloudinary_file_name.jpg
Completed 302 Found in 48ms (ActiveRecord: 13.8ms)
cloudinary.yml
development:
cloud_name: <%= ENV['CLOUDINARY_CLOUD_NAME'] %>
api_key: <%= ENV['CLOUDINARY_API_KEY'] %>
api_secret: <%= ENV['CLOUDINARY_API_SECRET'] %>
secure: true
cdn_subdomain: true
production:
cloud_name: <%= ENV['CLOUDINARY_CLOUD_NAME'] %>
api_key: <%= ENV['CLOUDINARY_API_KEY'] %>
api_secret: <%= ENV['CLOUDINARY_API_SECRET'] %>
secure: true
cdn_subdomain: true
test:
cloud_name: <%= ENV['CLOUDINARY_CLOUD_NAME'] %>
api_key: <%= ENV['CLOUDINARY_API_KEY'] %>
api_secret: <%= ENV['CLOUDINARY_API_SECRET'] %>
secure: true
cdn_subdomain: true
I just updated the cloudinary gem to 1.13.0 and didn't see a change. If you need anything else let me know.