# Why Cloudflare “Cache Everything” Isn’t A Good Idea

> The Cloudflare "Cache Everything" option seems appealing. Unfortunately, it just doesn't work like you think it will. Read to find out why!

- Author: [Bhagwad Park](https://www.namehero.com/blog/author/bhagwad-park/)
- Published: 2018-12-24
- Updated: 2018-12-24
- Category: [Website Performance](https://www.namehero.com/blog/category/website-performance/)
- Web page: https://www.namehero.com/blog/why-cloudflare-cache-everything-isnt-a-good-idea/

Cloudflare is a pretty amazing service, and probably the only on that I know of with a free reverse proxy setup. For most website owners, its value comes from the caching service for static assets by default. I personally also use its DNS servers since I find their response times far faster than those used by my web host.

As just mentioned, Cloudflare automatically caches your JS, CSS, “woff” files (fonts) etc. You don’t need to explicitly specify this. These files are chosen for two very good reasons:

1. They are static and don’t change often
2. They are requested on almost all page loads for your site

Once these assets are in Cloudflare’s cache, you can use webpagetest.org to see how fast they load compared to the loading speeds from your own origin server. It’s not even close:

[![Cache Hits from Cloudflare](https://www.namehero.com/blog/wp-content/uploads/2018/12/Cache-Hits-from-Cloudflare.png)](https://www.namehero.com/blog/wp-content/uploads/2018/12/Cache-Hits-from-Cloudflare.png)

All of the assets in the screenshot are cache “hits” on Cloudflare. You can see that it takes between 43 to 69 *milliseconds* to search each resource. That’s *very* small. Most likely your origin server clocks in with several hundred milliseconds.

## So “Cache Everything”?

This leads one to wonder why we simply don’t cache *everything* on Cloudflare instead of just static content. In its “Page Rules” section for example, we can force Cloudflare to cache the contents of all requests using the page rule:

**[yourwebsite]**

[![Cloudflare Cache Everything Page Rule](https://www.namehero.com/blog/wp-content/uploads/2018/12/Cloudflare-Cache-Everything-Page-Rule.png)](https://www.namehero.com/blog/wp-content/uploads/2018/12/Cloudflare-Cache-Everything-Page-Rule.png)

Here, we tell Cloudflare to cache everything for 1 month (the maximum allowed).

This means that all of our web pages will be served from Cloudflare’s EDGE caches all over the world right? In fact, our origin server won’t even be touched! Right?

Not so fast.

## “Cache Everything” Doesn’t Work Like You Think

Unfortunately, this simplistic page rule causes more problems than it solves. At best, it slows down your site. At worst, it actively harms it. Here’s why.

### You’ll Show Admin Pages to Your Visitors

Even relatively static websites don’t show the same page to all their visitors. A prime example is logged in and logged out users. On WordPress sites for example, a lot of users have the Jetpack plugin which adds an admin bar when you’re logged in.

If you happen to visit a page on your site before anyone else, Cloudflare will cache that and show subsequent visitors the logged in version with the admin bar!

Now Cloudflare has an option to bypass the cache with a cookie. This would work great, except that it’s only available to Business users for $200 a month per domain!

[![Bypass Cache on Cookie Only for Cloudflare Business and Enterprise](https://www.namehero.com/blog/wp-content/uploads/2018/12/Bypass-Cache-on-Cookie-Only-for-Cloudflare-Business-and-Enterprise.png)](https://www.namehero.com/blog/wp-content/uploads/2018/12/Bypass-Cache-on-Cookie-Only-for-Cloudflare-Business-and-Enterprise.png)

Having said that, there are ways to disable the Cloudflare cache when you’re a logged in user. I’ll explore some methods in another article.

### You’ll Slow Down your Site

The first hit to an EDGE cache is always a tad bit slower than a direct request to the origin server. That’s because the EDGE server needs to make the request to the origin server anyway in order to cache it for later. Cloudflare has 158 EDGE locations. That means *each* page of yours will have to be requested at least once from *each* of these EDGE locations to be completely cached everywhere.

If you have 100 pages on your site (a modest number), that means your site has to be pinged 158*100 = 158,00 times for it to be complete cached. And that’s assuming each request comes from a different combination of page and EDGE server!

### The Content Won’t Be Cached

To make matters worse, all CDNs have some form of selective cache purging. If a resource is requested only infrequently, it will probably be removed from the cache and the server will request it again from the origin.

This means that pages which are infrequently visited will almost never get a hit on the EDGE cache. Even if they do get cached, they’ll just drop away at once.

### Any Changes Will Reset the Cache

Finally, anytime you make the smallest change to your HTML, the entire cache will reset. It’s terrible!

Bottom line: Cloudflare’s free “Cache Everything” option looks seductive, but it just doesn’t work. Even if you manage to avoid showing admin pages to your users, it’s just extremely inefficient, and will actually slow down your site by adding an additional request to each and every ping to your origin server.

## Related posts

- [“Cache Everything” On Cloudflare The RIGHT Way](https://www.namehero.com/blog/cache-everything-on-cloudflare-the-right-way/)
- [How To Force Cloudflare To Cache Resources](https://www.namehero.com/blog/how-to-force-cloudflare-to-cache-resources/)
- [Use Cloudflare Cache Rules Instead Of Page Rules](https://www.namehero.com/blog/use-cloudflare-cache-rules-instead-of-page-rules/)
- [How To Achieve ~90% Cache Hit Ratio On Cloudflare](https://www.namehero.com/blog/how-to-achieve-90-cache-hit-ratio-on-cloudflare/)
