Documentation

Cloudflare Setup

This article assumes that you’ve already setup an S3 bucket and followed the steps within our Quick Start Guide. The S3 bucket name must be the same as the CNAME you wish to use. You will also need an account with Cloudflare and your DNS nameservers should be pointing to their servers.

Once the above steps are taken care of, you will need to determine your S3 bucket URL. To do this prepend your region and bucket name to ‘.amazonaws.com’. For example:

cdn.delightfuldownloads.com.s3-eu-west-2.amazonaws.com

Configure Cloudflare

Login to Cloudflare and head to the DNS tab. Add your CNAME and bucket URL.

The orange cloud next to the DNS entry indicates that traffic to the hostname will be proxied through the Cloudflare CDN. You do not need to enable Cloudflare on any other hostname for this to work.

Configure WP Offload S3

Login to your WordPress dashboard and navigate to AWS > S3 and CloudFront. Enable the CloudFront or Custom Domain option and enter your CDN URL.

Save the changes and clear your page cache if you have one enabled.

HTTPS

If your site has an active SSL certificate Cloudflare will automatically enable ‘Full SSL’, which will ensure that you do not receive mixed content warnings on the front-end.

If your site doesn’t have an SSL certificate, but you want your assets to be served over HTTPS you can enable ‘Flexible SSL’ in Cloudflare. You will also need to turn on ‘Force HTTPS’ in WP Offload S3.

Testing Everything Works

If you load your site’s front-end and open the developer tools (cmd alt i) you should see that your assets are now being served from Cloudflare. You can confirm this by checking the response headers, which should contain a ‘CF-Cache-Status’ header.