Table of Contents

Loading website...

This post is about clouds. No – not the fluffy kind in the sky. Two specific types of clouds – Cloudflare vs CloudFront.

At a basic level, both of these tools aim to speed up your website for global visitors by storing your static content at lots of different servers around the world. If you’re not familiar, the term for this is “content delivery network” (or CDN).

However, while Cloudflare and CloudFront share the same goal, they go about it in different ways and also have slightly different feature sets.

In this post, I’ll compare Cloudflare vs Amazon CloudFront to help you pick the solution that’s right for your WordPress site.

Side note – you can use WP Rocket with either Cloudflare or CloudFront, so you’ll be covered no matter which one you pick!

Cloudflare vs CloudFront: The Basic Differences

Ok, so both Cloudflare and CloudFront are CDNs. However, beyond that, there’s a big difference in how they function.

Cloudflare Explained

Cloudflare Map

Cloudflare is actually a reverse proxy. In part, that means that, when you set up your site with Cloudflare, you’ll actually point your domain’s nameservers to Cloudflare.

Then, Cloudflare will direct all the traffic to your site. This gives Cloudflare a lot of control over your site, and this is also what allows Cloudflare to offer extra functionality beyond its CDN (more on this in a second).

Here’s the process in a little more detail:

When someone visits your site, Cloudflare will take your static content and store your content on Cloudflare’s network of servers around the world. Then, for future visitors, Cloudflare can serve up that cached static content from the Cloudflare edge server that’s nearest to each visitor.

Because of how this approach works, all of your content will still load from yoursite.com. This is different from how a lot of other CDNs work, where it’s common to serve your content from a separate URL like cdn.yoursite.com.

Beyond its CDN functionality, Cloudflare also has a number of other benefits on its free plan including:

  • Free shared SSL certificate
  • DDoS protection

If you’re willing to pay for a premium plan, you can also add on functionality like:

  • Web application firewall (WAF)
  • Image and mobile optimization
  • More control over security and your CDN

Amazon CloudFront Explained

Cloudfront Map

Amazon CloudFront, on the other hand, is more of a “traditional” CDN. That is, you don’t need to change your nameservers to CloudFront like you do with Cloudflare’s reverse proxy approach.

Instead, CloudFront will automatically “pull” the data from your origin server onto CloudFront’s network of servers around the world. It’s also possible to “push” your content on to CloudFront – more on this later.

However, because CloudFront isn’t controlling your nameservers like Cloudflare does, CloudFront cannot automatically make your WordPress site serve up content from a different edge server.

That’s where the separate URL comes in.

Using something like cdn.yoursite.com, you’ll rewrite the URLs of the static content on your site so that they load content from cdn.yoursite.com (the nearest CloudFront edge server) instead of yoursite.com (your origin server).

This is what the CDN tab helps you do in WP Rocket – you can enter the URL of your CDN and choose which files it should apply to (and even manually exclude certain files from being served via the CDN):

Setting up a CDN with WP Rocket

CloudFront is also part of the whole Amazon Web Services (AWS) ecosystem, which makes it convenient if you’re using other AWS services (like Amazon S3).

CloudFront offers 50 GB of free data transfer for one year. After that, you’ll pay per GB of data transfer.

Should You Use Cloudflare or CloudFront on WordPress?

Most WordPress users will be better suited by Cloudflare because:

  • It has a simpler setup process than Amazon CloudFront
  • The free plan will fit the needs of most WordPress users
  • WP Rocket offers a dedicated Cloudflare integration
  • Cloudflare has a slightly larger network of edge servers, though the difference is small
  • Cloudflare does “more” than just content delivery, with lots of beneficial security features as well

That’s certainly not to say that Cloudflare is always better than Amazon CloudFront. It’s just that a lot of CloudFront’s benefits aren’t things that most WordPress users will care about.

For example, CloudFront gives you more control over nitty-gritty details like HTTP headers and cache invalidation, and CloudFront also works with live streaming content.

However, most WordPress users won’t need that functionality, and will be better served by the simplicity of Cloudflare.

How to Set Up Cloudflare and CloudFront

To finish things out, we’ll give you a high-level look at what the setup process is like at both Cloudflare and CloudFront.

How to Set Up Cloudflare

As you learned above, Cloudflare has one of the easiest setup processes.

When you sign up for your free Cloudflare account and start the “Add Site” wizard, Cloudflare will prompt you to change your domain’s nameservers to point towards Cloudflare. Again, this is required because of Cloudflare’s reverse proxy approach:

Once you do that, you’ll be able to manage your Cloudflare settings from the Cloudflare web dashboard.

If you’re using WP Rocket, you can also connect WP Rocket to your Cloudflare account so that you’re able to manage some important settings and clear your Cloudflare cache right from your WordPress dashboard:

Cloudflare vs Cloudfront: Cloudflare settings

You can learn more about WP Rocket’s Cloudflare integration in this help article.

How to Set Up CloudFront

There are two ways to use CloudFront with WordPress:

  • Pull – you tell CloudFront to “pull” the files from your WordPress site’s server as needed. CloudFront will then cache these files on its servers.
  • Push – you “push” your site’s static files to Amazon S3 (Amazon’s object storage service) and then tell CloudFront to use the files in your S3 bucket. If you use this approach, you’ll need a plugin like WP Offload Media Lite to offload your static WordPress files to Amazon S3.

To get started, you’ll create a new “Distribution” and tell CloudFront whether you want it to take files from your WordPress server or from a different location, like an S3 bucket:

Cloudflare vs Cloudfront: Cloudfront settings

This guide from Amazon covers the process in more detail.

Once you’ve done that, you can use WP Rocket to serve files from the URL that CloudFront gives you – e.g. http://d111111abcdef8.cloudfront.net.

Or, you can also set up CloudFront to work with your own domain name by setting up an alternate domain name (CNAME).

Cloudflare vs Amazon CloudFront: A Recap

To sum up, both Cloudflare and Amazon CloudFront offer content delivery network functionality that can speed up your website’s global page load times and reduce the load on your server.

Cloudflare is a reverse proxy which means, in part, that you’ll use Cloudflare’s nameservers and Cloudflare will actually handle directing traffic for your site. This also comes with other benefits, like security and DDoS protection.

Amazon CloudFront, on the other hand, is more of a “traditional” CDN. You won’t need to change your nameservers. Instead, you can either have CloudFront automatically “pull” files from your WordPress site’s server onto CloudFront’s servers, or you can use a plugin like WP Offload Media Lite to “push” files into an Amazon S3 bucket and have CloudFront serve them from there.

Of the two, Cloudflare has a much simpler setup process and will make the best option for most WordPress users who don’t need detailed control over how the CDN cache works or have unique situations like live streaming content.

Finally, no matter which content delivery network you choose, WP Rocket can help you with the setup process, either through its CDN features or its dedicated Cloudflare integration.


Comments (5)

I fully agree. I am a heavy cloudflare user and cloudflare not only speed up many of my websites but also protect them by hiding the true IPs.

I have been using Cloudflare ever since it was launched.

In the initial stages, there was a lot of criticism and hiccups. People using Cloudflare faced problems like slower websites, websites often showing as down etc. Those are things of the past.

But at the same time, if people think that their WordPress website will get the boost by simply using Cloudflare, then they are wrong. A WordPress website still needs a caching plugin.

Before using WP Rocket while still using Cloudflare, my WordPress website used to load but not as fast as I had expected. However, I have experienced a colossal boost after using WP Rocket. As the name suggests, my site now loads at the blink of an eye.

Unlike other caching plugins, WP Rocket needs minimal configuration, but if you take the pain to go through each of the self-explanatory sections, you will be able to make the most of this plugin. In my case, all that it took was less than a minute to configure WP Rocket. The novices need not be scared if anything goes wrong. WP Rocket team is always there to assist us.

So if you are still not using WP Rocket, I would highly recommend to try it at least once and you won't be disappointed.

I think another key component of Cloudflare that is left out here is Workers -- https://workers.cloudflare.com/ -- you can transform any request at the edge. Previously this was an enterprise only feature but they now have a free tier available to anyone https://support.cloudflare.com/hc/en-us/articles/360001657552-Billing-for-Cloudflare-Workers-and-Workers-KV

Actually you can serve the whole wordpress site from cloudfront by making the origin wordpress.yoursite.com(where wordpress is served), and cname (or alias) yoursite.com to XXX.cloudfront.net.

Latest Articles of Page speed and caching
Subscribe to Our Newsletter

Stay in the loop with the latest WordPress and web performance updates.
Straight to your inbox every two weeks.

Get a Faster Website
in a Few Clicks

Setup Takes 3 Minutes Flat
Get WP Rocket Now