Understanding How Caching Works In Cloudflare

What Is Caching And Why Is It Important?

Ever wondered how your website serves pages and images quickly? Of course, high-speed internet is one of the factors but another reason is that these files are stored in a temporary location which allows them to be accessed much more quickly.

That’s essentially what caching is - the process of storing files so that future visits for them can be served much faster.

All web browsers cache HTML, CSS and JavaScript files as well as images to allow websites to load more quickly.

Cloudflare And Content Delivery Networks

A content delivery network (CDN) in its simplest form is a group of servers that are distributed around the world at different locations. Their main function is to work together to speed up the delivery of online content.

Cloudflare is a leader in CDN solutions and a global network in making connections to your site secure, private and fast.

Cloudflare routes content requests along the fastest path while allowing precise control over your content's caching. By utilizing caching, CDNs like Cloudflare are able to reduce the amount of data an origin server must provide, which ultimately reduces hosting bandwidth and costs for website owners.

Cloudflare also offers major security features to help protect against malicious attacks.

Cloudflare’s Cache Behaviour

Cloudflare provides several options for cache optimization.

  • Customize caching with Cloudflare Workers
  • Caching behaviour for individual URLs via Cloudflare Page Rules
  • Adjust caching level, and time to live before the cache expires

Workers is a feature in Cloudflare that was developed to allow developers to interact directly with the Cloudflare cache.

For page rules, a page rule matches a URL pattern based on the following format (made of five segments):

Caching Configuration

Once inside your Cloudflare, you can see different levels of caching configuration:

  • Purge Cache - this lets you clear cached files and forces Cloudflare to retrieve a fresh version of your files from the server
  • Caching Level - this allows you to set how much of your website’s static content you want Cloudflare to cache
  • Browser Cache TTL - this setting is the length of time Cloudflare informs visitors' browsers to cache files. During this time Cloudflare tells the browser will load files from its local cache speeding up page requests

Fishtank Consulting is a top-rated, award-winning, Certified Cloudflare Partner. Interested in learning more? We’d love to chat about how we can help you reach your website performance and reliability goals with Cloudflare.

We'll be cool about it. Promise.

Protect your website without compromising performance.

Improve your user experience and SEO with a faster and more available website.

Meet Asim Ahmed

Project Manager


Asim is a Project Manager who loves guiding teams to successful project completion and helps clients bring their goals to a reality. He has a Degree in Civil Engineering and a Masters in Information Technology. Outside of Fishtank, Asim runs a food business on Instagram with his wife, has a keen eye for photography, and is a huge football fan who closely follows his beloved Liverpool.

Connect with Asim