Cloudflare Pages - Is caching of any kind helpful for static file URL's hosted by Pages?

We’ve deployed a static site, assets and all - to a Cloudflare Pages site, hosted under our own domain of course.

A simple question - are any caching rules either effective or necessary for URL’s hosted on Cloudflare Pages?

I was confused about what would happen if we wanted to “Cache Everything” on assets that were already located (I believe) as a local asset on every Cloudflare node in the world.

Considering that most of a Pages site is static, those files are already candidates for caching. And that leaves the HTML portion. From what I see, Pages performs as well as “Cache Everything.” First try is a bit slow, but subsequent is a much faster TTFB for HTML.

You can certainly experiment with https://tools.keycdn.com/performance and see how it compares.

thanks for this note. However, taking the product definition of Pages, where it states that files are copied to all Cloudflare nodes - wouldn’t caching everything achieve exactly the same thing i.e. copy files into a local node that requested it for future requests?

I’m just confused as to what benefit caching provides or why/how it should work when we know that every file is already guaranteed as present in every node, worldwide.

I’ve not seen that, nor do I think that’s accurate. I think it’s more like Workers KV:

That’s pretty much what I said:

Again, I doubt this is the case, but I could be wrong.

It is, as you also get the 25MB per file limit with Pages.

1 Like

Got it - thanks both!

The critical question that Cloudflare could confirm is whether or not assets in Pages are actually copied throughout the world, to all nodes.

It seems to say so at Limits · Cloudflare Pages docs

We take each file in your site and upload it to our globally distributed network to bring low latency to every user that visits your site.

Sure, that data is somewhere in the Edge Network as opposed to your origin server. And when it’s needed, it’s pushed over to the corresponding data center. It’s more like Argo’s Tiered Caching.

noted - thanks. I’m just noting here for the Cloudflare Pages team. The core value prop of Cloudflare Pages is very fast static hosting. By this token, they should position it as “better than just caching” i.e. deploying to CF Pages actually copies the asset to all nodes. I’d even pay more for that guarantee, as the idea of “it’s somewhere but it might be far away” is really just like ordinary caching. The reason to actually move to Cloudflare Pages needs to be stronger for static sites, with a guarantee of global copies. This also means the first fetch from anywhere in the world is incredibly fast and local.

I’m sure you realize it’s impossible to copy all Pages content to all edge nodes. There just isn’t the capacity, nor the need (all 200+ worldwide data centers?). What it does get you is one less hop to an origin server outside Cloudflare’s network.

1 Like

In that case - isn’t that the same as using “Cache Everything”?

On the point above, I don’t see the specific value prop of moving all static hosting to Cloudflare Pages, when it can stay exactly where it is right now (in a different platform) - with just “Cache Everything” rules applied to static assets.

1 Like