Cloudflare Cache runs at 100% ! It can't be right?

Hi,

Before the 11th June, we were caching between 34% - 45%. After the 11th June we’re caching 100%.
We have purged the cache twice since then and it stays at 100%.

Not sure if 100% is correct, or theres a problem, or something we need to do. Any advice would be appreciated.

We’re using Cloudflare Pro.
Many thanks

Hi,

You would normally achieve near-100% caching if you are using a feature to cache HTML (which Cloudflare doesn’t cache by default.)

What’s your Cloudflare cache configuration?

Do you use APO for WordPress?
Cache Rules?
Page Rules with Cache settings?
Workers?

Many thanks for the response!

What we currently have in Cloudlare:

Caching Setup
Caching Level: Standard
Browser Cache TTL: 1 day
Caching Rules: None
Tiered Cache: Enabled
Cache Reserve: None
Page Rules with Cache settings: None
APO for WordPress: Disabled
Automatic Signed Exchanges (SXGs): Disabled

Others Related
Workers: None
Argo Smart Routing: Enabled
Mirage: Disabled
Polish: Disabled
Brotli: Enabled
Early Hints: Disabled
Rocket Loader: Disabled

Origin Server Caching setup
Images, JS, and CSS files
Cache-Control: public, max-age=31536000

HTML files
Cache-Control: s-maxage=60, stale-while-revalidate

The site is built in NextJs and we’re using Static Site Generation (SSG) and we we’re using Cloudflare Pro Plan.

Thanks

1 Like

Sorry, I’m not familiar with either.

What are the headers returned from your homepage? (or if you prefer, what’s your domain?)

Thanks, again,

Here are the headers from our homepage, product page, and an image (logo) we use.

Homepage

Request Method: GET
Status Code: 200
Alt-Svc: h3=“:443”; ma=86400
Cache-Control: s-maxage=60, stale-while-revalidate
Cf-Cache-Status: DYNAMIC
Cf-Ray: 7e5a2c265d3b107f-HKG
Content-Encoding: br
Content-Security-Policy: default-src ‘self’; img-src ‘self’ domain.com www.gravatar.com i.ytimg.com www.googletagmanager.com data:; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ www.googletagmanager.com .google-analytics.com app.termly.io ajax.googleapis.com ‘unsafe-eval’ ‘unsafe-inline’; font-src ‘self’ fonts.googleapis.com fonts.gstatic.com; frame-src ‘self’ www.youtube.com; connect-src ‘self’ domain.com www.googletagmanager.com .google-analytics.com app.termly.io; object-src ‘none’; frame-ancestors ‘none’;
Content-Type: text/html; charset=utf-8
Date: Wed, 12 Jul 2023 15:03:21 GMT
Nel: {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
Referrer-Policy: strict-origin-when-cross-origin
Server: cloudflare
Strict-Transport-Security: max-age=3600; includeSubDomains; preload
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Nextjs-Cache: HIT

Product Page

Alt-Svc: h3=“:443”; ma=86400
Cache-Control: s-maxage=10, stale-while-revalidate
Cf-Cache-Status: DYNAMIC
Cf-Ray: 7e5a3f8f9ca30435-HKG
Content-Encoding: br
Content-Security-Policy: default-src ‘self’; img-src ‘self’ domain.com www.gravatar.com i.ytimg.com www.googletagmanager.com data:; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ www.googletagmanager.com .google-analytics.com app.termly.io ajax.googleapis.com ‘unsafe-eval’ ‘unsafe-inline’; font-src ‘self’ fonts.googleapis.com fonts.gstatic.com; frame-src ‘self’ www.youtube.com; connect-src ‘self’ domain.com www.googletagmanager.com .google-analytics.com app.termly.io; object-src ‘none’; frame-ancestors ‘none’;
Content-Type: text/html; charset=utf-8
Date: Wed, 12 Jul 2023 15:16:36 GMT
Nel: {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
Referrer-Policy: strict-origin-when-cross-origin
Server: cloudflare
Strict-Transport-Security: max-age=3600; includeSubDomains; preload
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Nextjs-Cache: STALE

Logo (Image)

Request Method: GET
Status Code: 200
Accept-Ranges: bytes
Alt-Svc: h3=“:443”; ma=86400
Cache-Control: public, max-age=31536000
Cf-Cache-Status: HIT
Cf-Ray: 7e5a2c2878f6107f-HKG
Content-Length: 6783
Content-Type: image/png
Date: Wed, 12 Jul 2023 15:03:21 GMT
Etag: “649b0014-1a7f”
Expires: Thu, 11 Jul 2024 08:10:43 GMT
Last-Modified: Tue, 27 Jun 2023 15:28:20 GMT
Nel: {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
Server: cloudflare
Vary: Accept-Encoding

Your HTML pages are not being cached, as expected. They both return cf-cache-status: DYNAMIC. With HTML out of the equation, I wonder what other files may be contributing to the near 100% cache ratio.

If you visit https://dash.cloudflare.com/?to=/:account/:zone/analytics/traffic and click on Path in the first panel (under Request Summary), you should see the most visited paths. Are they images, CSS or JS files? Or non-cached HTML pages?

Thanks.

I did what you suggested and checked and mostly they are API paths, json(contains data), javascript, and images.
Only a few are html and CSS files.

Regarding the API paths, this is where we update our content on the fly using our own CMS.

Here are the headers from the API path and json files:

API path

Alt-Svc: h3=“:443”; ma=86400
Cache-Control: no-cache, private
Cf-Cache-Status: DYNAMIC
Cf-Ray: 7e5a6d9c3ff10512-HKG
Content-Encoding: br
Content-Type: application/json
Date: Wed, 12 Jul 2023 15:48:02 GMT
Nel: {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
Server: cloudflare
Vary: Origin, Accept-Encoding
X-Robots-Tag: NOINDEX,NOFOLLOW

JSON

Alt-Svc: h3=“:443”; ma=86400
Cache-Control: s-maxage=60, stale-while-revalidate
Cf-Cache-Status: DYNAMIC
Cf-Ray: 7e5a637cf9f204f0-HKG
Content-Encoding: br
Content-Security-Policy: default-src ‘self’; img-src ‘self’ domain.com www.gravatar.com i.ytimg.com www.googletagmanager.com data:; style-src ‘self’ ‘unsafe-inline’; script-src ‘self’ www.googletagmanager.com .google-analytics.com app.termly.io ajax.googleapis.com ‘unsafe-eval’ ‘unsafe-inline’; font-src ‘self’ fonts.googleapis.com fonts.gstatic.com; frame-src ‘self’ www.youtube.com; connect-src ‘self’ domain.com www.googletagmanager.com .google-analytics.com app.termly.io; object-src ‘none’; frame-ancestors ‘none’;
Content-Type: application/json
Date: Wed, 12 Jul 2023 15:41:08 GMT
Etag: W/“3xph5l8b7valq”
Nel: {“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
Referrer-Policy: strict-origin-when-cross-origin
Server: cloudflare
Strict-Transport-Security: max-age=3600; includeSubDomains; preload
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Nextjs-Cache: HIT

Thanks

Both returning DYNAMIC, so Cloudflare isn’t caching them. I can’t think of a scenario where you wouldn’t cache HTML and other most-visited files, and still near the 100% mark. Perhaps some of my @MVP colleagues or someone from Cloudflare Team might shed a light on what is happening here. (For the record, all my domains have the expected values for cached assets under the Dashboard > Overview panel, so I don’t think it’s a bug.)

1 Like

Do you happen to serve some data via Workers, by any chance?

1 Like

Hi Matteo

We just checked and we have installed Logflare and I believe it uses does in fact use Workers, could be it?
But using 100% cache, can that be right? What are the implications of 100% cache being used? Does it mean less assests will be cached from our site?

Many thanks

I’ve just noticed that 2 of our other accounts also have 100% cache.
These 2 accounts are sitting behind the cloudflare login page with no site or files on. basically, just domains on our server.

They also do not use LogFlare or any special features / no workers etc - these sites are on the free plan, unlike the site we’ve been talking about in my previous messages.

Any help would be appreciated

In case anyone else has the same issue, here is the update from Cloudflare support:

Hi there,

Our engineering team have advised that this is a known issue. They are aware of a discrepancy between cache ratio statistics on the Zone Overview and Cache Analytics.

This is a result of using certain Cloudflare features that cause the Zone Overview summary to be inaccurate. We are working to upgrade the Zone Overview summary and in the meantime you should use Cache Analytics.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.