On upgrading a web application to use ssl/https all over the site, our users encounter mixed-content issue when using Internet Explorer. (google link)
ie. Internet Explorer browser nags the User with a warning dialog, because our site url is https:// but we display an image that use http:// protocol.
We’ve been using PaperclipS3UrlRewriter Rack Middleware for this issue, but seems to be failing as of lately.
To solve this once and for all, we delve into paperclip docs, which brings us to the following solution:
1 2 3 4 5 6 7 8 9 10 11
Nice. mixed-content issue seemingly solved.
But follow-up issue cropped up when uploading an image, the image is not displayed in browsers.
So, Paperclip/S3 doesn’t set the file to publicly readable.
A snippet from
lib/paperclip/storage/s3.rb that affect this behaviour:
After checking out the code, we decided to remove PaperclipS3UrlRewriter middleware, discard the paperclip changes, and just replace (manually..) all calls to:
to the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13