Setting up HTTPS in Cloudflare and Amazon S3 for your Craft CMS site

There's a misconception that adding HTTPS to your site and serving Amazon S3 files from the same domain is difficult. To be honest, before I dove into this more, I thought it was too. In reality, there's only a few moving parts and even fewer gotchas. You don't have to pay Amazon $600/month for a custom URL. You don't even need an SSL certificate installed on your server anymore. And it's free.

Here's the demo of what we'll be building. Note that the image on the homepage is hosted from a custom subdomain, not a super-long Amazon AWS domain, and still served over HTTPS.

So how does all this work? In this 8ish minute screencast below I'll walk through:

  1. Signing into Amazon Web Services for the first time
  2. Setting your nameservers and configuring Cloudflare
  3. Configuring uploads within CraftCMS
  4. Creating a page rule within Cloudflare to enable HTTPS
  5. Updating those long Amazon S3 uploads paths http://s3-us-west-2.amazonaws.... to a clean, secure, https://files.yourdomain.com.

Tommy is a front-end developer who builds dynamic, interactive sites for Viget clients such as ESPN, Dick's Sporting Goods, and PUMA. He works in our Falls Church, VA, HQ.

More posts by Tommy