Cache does not work in cloudflare pages

Hi,

I noticed Cloudflare cache is not working in pages (I enabled cache everything using page rules)

I have some WordPress site and here are response headers:

cache-control: s-maxage=31536000, max-age=60
cf-cache-status: HIT

Here is response header of pages:

cache-control: public, max-age=0, must-revalidate

No cf-cache-status in pages why?

With Pages, I wouldn’t directly worry about not seeing the cf-cache-status header. This header is really only useful when looking at sites that have to hit an origin. In Pages, all of your assets are stored within KV, which means that they’re available on the edge and cached in a very similar way to how you might see origin assets and cf-cache-status.

If you want to override the cache-control header of your HTML pages, you can do so using _headers and there are definitely use-cases for this, but I wouldn’t be concerned about it for the vast majority of use-cases. Run the Wordpress site and then the Pages site through any website speed tester and I think the results will speak for themselves. :+1:

In addition, deploying any additional caching to a Pages site via Page Rules or _headers may result in unwanted behaviour, like any updates to your Pages site not reflecting immediately. Pages is very good at handling and caching your site’s assets in KV, and this is almost always not something you want to manually tweak.

4 Likes

May you elaborate on which pages it does not work?
Please send full URLs of the files which are not getting cached. Thanks.

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