How is R2 different than CF itself?

I got to play around a bit with R2 and I was wondering, deep down isn’t the R2 always available in CF? What I mean:

If I understand correctly R2 is build in order to allow developers host static files there, and then pull them directly through this bucket. Let’s say that I upload all the JavaScript files of my website to an R2 bucket and I load them directly from the bucket.

However if i create a rule that would edge cache the JavaScript files of my website for many days, won’t end up having the same result?

Hey,

So R2 will actually store files, meaning you won’t need them elsehwere (such as a VPS or S3). For caching, they’d still need to be stored somewhere else, they can also be evicted from the cache at any time. If you don’t get many hits, it’ll definitely be removed well before that few-day TTL.

For a site though you may be interested in Pages over R2 - https://pages.dev
It would offer much better performance, auto Git integration, and free unlimited requests!

4 Likes

I was mostly considering moving the JavaScript files of my web app from locally stored to be stored in CDN and this is how I came across R2!