Amazon S3, SSL & Craft
By Ian Ebden ·
So I'm working on a site at the moment on a secure server, and I'm redirecting all
http requests to
https (via .htaccess). All good except the site's images are on Amazon S3 (
http), and I was running into issues switching between protocols on local and production; plus some browsers issue mixed content warnings for mixed protocols on the same page.
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.
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.