Amazon S3, SSL & Craft
Ian Ebden · September 18, 2015
Hooking up Amazon's CloudFront service to your S3 account can fix this, but it's a costly solution. Another option is to configure SSL for your S3 bucket via CloudFlare. But here's a super-simple super-quick workaround that costs nothing.
All I'm doing is using the Twig 'replace' filter to strip the protocol off the file url so the browser request ends up looking like:
With no protocol specified the browser will just use the current one –
http on local or
https on production. Amazon already have SSL on their S3 domains so your image will load fine on either protocol.