Pages Deployment without overriding existing files

I want to deploy static assets (i.e. JSON) files that are needed for a versioned documentation. Therefore I want to deploy a folder with these files, with the folder name being the version number. Obviously I don’t want the folders of the old versions to be overridden by a deployment for a new version. And I want to have the version number in path to the asset, so that I can easily and dynamically replace the version number in the URL path to the assets. So separate hash subdomains are not working here for me as well.

Are Cloudflare Pages still the right thing here? We are also deploying a small frontend app and the overriding of the files for this is perfect. What else could I use within Cloudflare to really deploy “dumb” static assets. With all the Worker Functions etc. it is not clear how this simple standard CDN use case can be accomplished anymore!?

Thankful for every hint and help with this!

Maybe something like R2 would work for you? Allows you to upload a new folder without the need to worry about ones you have previously uploaded.

1 Like

Thanks very much for your quick answer @Cyb3r-Jak3 !

I had a look and from what I could see so far from the docs, it seemed promising:

I just wondered if you could also throw in a whole folder into the wrangler r2 object put command, or if I have to loop over all files in a folder on my own?

You would have to loop over each file. I would recommend something like rclone · Cloudflare R2 docs for handling folder uploads.