Cloudflare R2
Create the bucket
Section titled “Create the bucket”Create a bucket under R2 object storage in the Cloudflare dashboard. Leave public access off.
Create a credential
Section titled “Create a credential”- On the R2 object storage page, open Overview. Under Account Details, choose Manage next to API Tokens.
- Choose Create Account API token or Create User API token.
- Under Permissions, choose Object Read & Write, and limit the token to your bucket.
- Copy the Access Key ID and Secret Access Key.
Cloudflare’s token docs describe each permission.
Connect it
Section titled “Connect it”| Field | Value |
|---|---|
| Provider | Cloudflare R2 |
| Endpoint | https://<account id>.r2.cloudflarestorage.com |
| Bucket | Your bucket’s name |
| Region | auto |
| Path-style URLs | Off |
A bucket in a jurisdiction uses that jurisdiction’s endpoint, for example https://<account id>.eu.r2.cloudflarestorage.com.
Allow browser access
Section titled “Allow browser access”Add the rule by hand. Cloudflare only describes its Admin Read & Write permission as able to change bucket settings, so expect Apply for me to be refused with an Object Read & Write token.
- Copy the rule from How to set up.
- In the dashboard, open your bucket, go to Settings, and choose Add CORS policy under CORS Policy.
- Open the JSON tab, paste the rule, and save.
- Run Test in Fileee. A change can take up to 30 seconds to apply.
See Configure CORS for more.
Public CDN links
Section titled “Public CDN links”A custom domain exposes the whole bucket, so you should need a separate bucket for public copies. See Public CDN links.