Cloudflare is not respecting Cache-Control headers

I have the following Cache-Control header being sent (and I can see it from my browser):

Cache-Control: public, max-age=600, stale-while-revalidate=30

My expectation is that Cloudflare would always return the cached version and fetch the new one in the background. However I’m always getting:

cf-cache-status: DYNAMIC

In case this helps: cf-ray: 673cf4847fd0b6c5-LUX

Cloudflare only caches certain file extensions by default, and does not cache things like HTML unless you configure a Cache Everything page rule. DYNAMIC indicates that you need to apply Cache Everything.

1 Like

I tried doing that now and it worked partially, however I found another issue:

While the max-age is being respected, the stale-while-revalidate isn’t.

Steps to reproduce:

  1. Request before max-age: response is fast and cf-cache-status: HIT
  2. Request after max-age and within stale-while-revalidate: response is slow and cf-cache-status: REVALIDATED

Expected: cf-cache-status: EXPIRED

Update: this is a known issue ignored by Cloudflare… Great.
Also here

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