CF-Cache-Status always returns DYNAMIC

I’m am trying to get Cloudflare to cache the content for my REST API endpoint -

When I try the command curl -I -X GET "", I get the response header CF-Cache-Status: DYNAMIC (not cached). I’m expecting CF-Cache-Status: HIT (cached).

I’ve tried:

  • ensuring the dns has “Proxy Status=Proxied”.
  • creating page rules for with “Cache Level=Standard” and “Origin Cache Control=ON”
  • adding Cache-control response headers:
    • Cache-control: public,s-max-age=30,max-age=30
    • CDN-Cache-Control: public,s-max-age=30,max-age=30
    • Cloudflare-CDN-Cache-Control: public,s-max-age=30,max-age=30
  • upgrading my account to pro - to use the Caching Analytics. Unfortunately it doesn’t explain why my endpoint is still DYNAMIC.
  • testing in Chrome browser, I’ve unchecked “Disable cache”

I have no idea why my cache instructions are being ignored. Please point me in the right direction.

Kind regards,

Based on what I see you aren’t calling an asset type that would be cached with the standard (default) cache level.

To cache that would require a cache everything rule or config.

Hi @cscharff ,

I think I understand - because my url doesn’t have a cached asset type (e.g. .js extension), Cloudflare doesn’t apply the standard (default) cache level.

Any idea what sort of config I’d need to add to enable the “30 seconds” cache I’ve specified in my response headers?

e.g. I’ve created a page rule to explicitly enable “Cache Level=Standard” and “Origin Cache Control=ON” for the exact url.

Kind regards,

Try making its page rule:

  • ‘Cache Level’ » ‘Cache Everything’

@jwds1978 - thanks, I’ll give it a go.

Question: will that still respect query parameters, and the 30 second max-age ?

Answer: from my tests - it appears so.

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