Caching and cf cache status

i have used Cloudflare caching for loading my images.the first time i try the TTFB is always a problem. The same happens when i enter our URL and visit the site. The response Headers give a cf-cache-status: MISS.

When i hard-refresh the site get cached and the cf-cache-status changes to HIT. So Cloudflare DOES work.

It looks like every single visitor needs to cache the site for themselves. Is this normal behaviour for Cloudflare?

Not quite. Every single edge node server needs to cache a file for itself. And standard Edge cache is ~4 hours.

The good news is that Tiered Caching is now free for everybody. That should help some. You’d just need to enable it from the Cache settings in the Cloudflare dashboard.

thanks for getting back to me. Tiered caching is all enabled and edge cache is set to 2419200 seconds which is 4 weeks. is there a way that when i first load my page the cf-cache-status to be hit, now is literally a miss for every first hit. My settings are

Browser Cache TTL: an hour, Cache Level: Cache Everything, Edge Cache TTL: 2419200 seconds

@user6568 You simply need to clear your cache after you’ve deployed your site. That action will instruct Cloudflare to fetch and cache a fresh copy (and serve a cache HIT for subsequent visitors).

You can do this via the API, or manually under Dashboard > Caching > Configuration > Purge Cache.

Two important things to keep in mind relating to Cache-Control headers:

  • Since Cloudflare is a proxy, setting the s-max-age headers will affect the cache duration on Cloudflare’s Edge network
  • The regular max-age header will affect your user’s browser cache, not Cloudflare’s

Remember that Edge Cache TTL is a maximum amount of time it’s safe to keep that file in cache. It doesn’t mean it will stay in cache for that long. Cloudflare will evict seldom-used resources to make room for newer and/or higher demand resources.

1 Like

hi @paramdeo . i will try that but i also saw on cloudflare that if response header is private than it does not cache it in edge network because my response header is private. i dont know if thats the issue .


Hey @user6568,

Definitely, the Cache Control header needs to be public for the caching to work. If it’s set to private then caching is effectively turned off.

So instead of private, max-age=3600 it should be public,s-max-age=604800,max-age=3600, where s-max-age is what Cloudflare respects, and max-age is what your visitor’s browser respects.

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