Cloudflare keep to Revalidated my static files even my origin tell to keep a half-year
I found that many path got Revalidated very frequently and lead to high load on my origin server. I want Cloudflare to cache this files as most as possible but this keep revalidate all day.
I'm on enterprise plan and support center tell me to try purge that path then that work fine, after that every request for this path got HIT.
That's mean I need to purge all of path which faced this problems.
I want solid solution to fix this problem, Could you please suggest the correct way rather than purge all of path? (Because this very expensive for large domain.)

11 Replies
Here's my response header from Cloudflare
and some request got HIT, I don't know why this happen.
Here's page rule for this domain.

fyi; For this domain I want Cloudflare to cache everything forever.
Cloudflare Docs
Cache by status code · Cloudflare Cache (CDN) docs
Customers can set cache time-to-live (TTL) based on the response status from the origin web server. Cache TTL refers to the duration of a resource in the Cloudflare network before being marked as STALE or discarded from cache. Status codes are returned by a resource's origin.
basically you need to update the TTL for your 300-599 range to exclude 304 otherwise once the asset is revalidated the first time, the ttl of the asset will become no-cache (i.e always revalidate) instead of whatever ttl you set for hte 200
So, that mean If I remove response header
etag
out. Client will not try to revalidate it and Cloudflare will never revalidate asset with my origin server right?you don't want to do that. you should update the rule that sets
300-599: no cache
to: 300-303: no cache
and 305-599: no-cache
this way the 304 status code will inherit the ttl of the 200 which you have as "forever"Wow, I think we found the root cause. Here's my current config

I need to change my setting to like this?

Thank you so much, I will try to confirm this on production by next week.
that's correct