(rclone)[https://rclone.org/install/]
curl https://rclone.org/install.sh | sudo bash
[r2]
type = s3
provider = Cloudflare
access_key_id = <id>
secret_access_key = <key>
endpoint = https://<endpoint>.r2.cloudflarestorage.com
acl = private
A Cloudflare Worker to make your R2 bucket public!
- Cloudflare Account
wrangler >= 2.0.2
Note: Ensure you are using at the minimum specified version of wrangler.
-
Fork this repo
-
Install dependencies (including Wrangler 2)
npm install
- Create a bucket to be made public
wrangler r2 bucket create public
- Update the
wrangler.toml
to bind the R2 bucket
[[r2_buckets]]
binding = 'PUBLIC' # <~ valid JavaScript variable name
bucket_name = 'public'
- Deploy the worker!
wrangler publish
- 🎉 You've got a public bucket
Give it a try: https://r2-public-worker.cdmacken.workers.dev/duck.png
URL's even support spaces! https://r2-public-worker.cdmacken.workers.dev/space%20duck.webp