What is the right Cloudflare cache behavior working with Workers?
Hi guys, I think I'm pretty confused of my understanding about how CF edge cache works, especially when it works with Workers.
What is the right cache behavior of this Workers code?
Let's assume the Cloudflare Cache setting is like this:
I've also read https://developers.cloudflare.com/cache/concepts/cdn-cache-control/ page and set Cloudflare-CDN-Cache-Control header with the same value, but it still didn't seem to be cached by the Edge cache.
Based on the behavior described above, it seems that Cloudflare Workers are treated somewhat differently from a typical origin (particularly with respect to caching behavior). Is this correct? And if so, is there any way to make this response cached by cloudflare?
Thank you.
What is the right cache behavior of this Workers code?
Let's assume the Cloudflare Cache setting is like this:
- Cache eligibility: Eligible for cache
- Origin Cache Control: Enabled
Cf-Cache-Status: HIT header because the Origin Cache Control is enabled so the cache should respect the Cache-Control header of the repsonse, but it seems not. It doesn't include the Cf-Cache-Status header at all.I've also read https://developers.cloudflare.com/cache/concepts/cdn-cache-control/ page and set Cloudflare-CDN-Cache-Control header with the same value, but it still didn't seem to be cached by the Edge cache.
Based on the behavior described above, it seems that Cloudflare Workers are treated somewhat differently from a typical origin (particularly with respect to caching behavior). Is this correct? And if so, is there any way to make this response cached by cloudflare?
Thank you.
Cloudflare Docs
CDN-Cache-Control is a response header field set on the origin to separately control the behavior of CDN caches from other intermediaries that might handle a response. You can set the CDN-Cache-Control or Cloudflare-CDN-Cache-Control response header using the same directives used with the Cache-Control.