Cache stopped working (cf-cache-status: DYNAMIC) after Purge Everything

What is the name of the domain?

remediocaseiro.blog.br

What is the issue you’re encountering

Hi everyone, After performing a “Purge Everything” on my site, I noticed that Cloudflare is now returning cf-cache-status: DYNAMIC, even though I have the “Ignore cache-control header and use this TTL” option enabled (set to 2 days). Before the purge, everything was working as expected — I was getting either cf-cache-status: HIT or cf-cache-status: MISS, depending on the request. According to this article from Cloudflare (section 3), if: - The response from the origin includes Set-Cookie, - Cache Level is set to Cache Everything, and - An Edge Cache TTL is set, Then Cloudflare should strip the Set-Cookie header and cache the asset. All these conditions are met on my end, but caching still isn’t working. Is there something I’m missing? Could this be a temporary behavior after the purge? Any guidance or insight would be appreciated. Thanks in advance!

What are the steps to reproduce the issue?

curl -I https://remediocaseiro.blog.br

Screenshot of the error

Hey there,

I’m currently not able to reproduce the issue you are initially reporting. Checking your domain that you have shared with us, at the moment I’m seeing a cf-cache-status: MISS for my first request and cf-cache-status: HIT for subsequent requests.

One thing that could have caused this issue is that if you created a Cache rule to bypass cache and placed this rule under the cache everything rule then the second rule would override the cache eligibility setting and treat the request as not eligible for cache. This is because all cache rules that match with the request will be evaluated, and the last matching rule can override cache settings placed by previous rules.

For more information on ordering of cache rules and how ordering impacts rules, I would suggest taking a look here:

Hi Micky, Thanks to take a time to help me and yes, at least on the homepage of the site I was able to create a “Page Rule” that works well with static URLs (like any site’s homepage), but for dynamic URLs such as the pattern https://domain/{slug}, they don’t work because they cache everything—and that’s not what I want.

For URLs following the pattern https://domain/{slug}, I configured my backend to send the header x-unconditional-cache: 1, and I created a cache rule with the settings shown in the image below. However, caching still isn’t happening, and the result that confirms this is cf-cache-status: DYNAMIC instead HIT or MISS on the pages that return this header.


I starting to believe the information in this Cloudflare article (section 3) is incorrect.

Cache rules work on request headers, not on response headers.

You should use “Use cache-control header if present, bypass cache if not” and set an appropriate cache-control header on your origin.

1 Like

Yes!! You pointed me in the right direction!
Now, no more page rules or custom headers—just send the Cache-Control header as public with a max-age greater than zero on the pages you want to cache.

Thanks!

1 Like

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