How to Test if Your Website is Cached by Cloudflare

Monazir Muhammad Doha | Jan 8, 2024 min read

Do you use cloudflare cache to seed up your website? Well, then you better know if it’s working or not. One effective way to tell if a response/page was served from the cache or not is to check the response header. We will talk about it in Method 02, but first let me show you a faster and easier way to do the same thing in Method 01.

Method 01: Fast & Easy (using CCT)

Cloudflare Cache Tester or CCT in short is a web app that can tell you wheather your website is cached by Cloudflare Edge server or not. It will tell you exactly how the response was served. For example, was it served directly from the cache? Was it revalidated? if yes how? Or was it not found in cloudflare’s cache server? if not, why? Is it not eligible for caching?

Step 01

To use it, just go to cct.houndsec.net and the following page will open.

cct home page

Step 02

The page is pretty self-explanatory. You have to type the url of the content you want to test. For example, you can type the the home page url of your website. I’ll type https://houndsec.net for obvious reason.

typed in houndsec.net in cct home page

And as soon as I hit the submit button, it will present the test result along with the relevant response headers.

Test Result

cct test result

As you can see, cloudflare served a stale version of the content after revalidating. It also gives you an idea of how it was done.

Method 02: Using DevTools

This method is a bit tech savvy, but you have a website set up on the internet. Trust me, you can do this!

Step 01

Open your website in a desktop browser.

Step 02

Press F12 to open the DevTools. A window will appear.

Step 03

Navigate to the “Network” tab within the DevTools window.

Step 04

Perform a hard reload of your website by pressing CTRL + SHIFT + R or CMD + SHIFT + R if you are on a Mac.

Step 05

Once the page reloads, all HTTP requests will be displayed in the network tab.

Step 06

Select any HTTP request, and inspect the cf-cache-status header in the “Response Headers” section.

The following is a list of values and their meaning cloudflare can send in the cf-cache-status header. It was collected from cloudflare official documentation

Value Meaning
HIT The resource was found in Cloudflare’s cache.
MISS The resource was not found in Cloudflare’s cache and was served from the origin web server.
NONE/UNKNOWN Cloudflare generated a response that denotes the asset is not eligible for caching. This may have happened because: A Worker generated a response without sending any subrequests. In this case, the response did not come from the cache, so the cache status will be none/unknown. A Worker request made a subrequest (fetch). In this case, the subrequest will be logged with a cache status, while the main request will be logged with none/unknown status (the main request did not hit the cache, since Workers sit in front of the cache). A WAF custom rule was triggered to block a request. The response will come from the Cloudflare global network before it hits the cache. Since there is no cache status, Cloudflare will log as none/unknown. A redirect cache rule caused the global network to respond with a redirect to another asset/URL. This redirect response happens before the request reaches the cache, so the cache status is none/unknown.
EXPIRED The resource was found in Cloudflare’s cache but was expired and served from the origin web server.
STALE The resource was served from Cloudflare’s cache but was expired. Cloudflare could not contact the origin to retrieve an updated resource.
BYPASS The origin server instructed Cloudflare to bypass the cache via a Cache-Control header set to no-cache, private, or max-age=0, even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling Origin Cache-Control. Cloudflare also sets BYPASS when your origin web server sends cookies in the response header. If the Request to your origin includes an Authorization header, in some cases, the response will also be BYPASS. Refer to Conditions in the Origin Cache-Control behavior section for more details.
REVALIDATED The resource is served from Cloudflare’s cache but is stale. The resource was revalidated by either an If-Modified-Since header or an If-None-Match header.
UPDATING The resource was served from Cloudflare’s cache and was expired, but the origin web server is updating the resource. UPDATING is typically only seen for very popular cached resources.
DYNAMIC Cloudflare does not consider the asset eligible to cache, and your Cloudflare settings do not explicitly instruct Cloudflare to cache the asset. Instead, the asset was requested from the origin web server. Use Cache Rules to implement custom caching options.

By checking the cf-cache-status header, you can easily determine whether the response was served from the cache or not. Happy caching!