Cloudflare R2
R2 is the object storage of Cloudflare. It charges nothing for the traffic of files that are opened, and its free tier holds 10 GB a month. How storages work, and where each kind of file goes, is on Storage.
You need a Cloudflare account with R2 turned on. Cloudflare asks for a payment method for it, even within the free tier.
1. Make a bucket
- In the Cloudflare dashboard, open R2 object storage.
- Press Create bucket and give it a name, such as
riverside-uploads: lowercase letters, digits and hyphens. - Leave it private. Your site signs a link for each view.
The Account ID is on the R2 overview page, under Account Details. Copy it.
2. Make an API token
- On the R2 overview page, under Account Details, press Manage beside API Tokens.
- Press Create Account API token.
- Give it Admin Read & Write, so your site can also set the CORS rule of the bucket, and press Create.
- Copy the Access Key ID and the Secret Access Key. Cloudflare shows the secret only once.
Object Read & Write on this bucket alone works too, but then you add the CORS rule yourself (step 4).
3. Connect it
- In WordPress, go to Poly Community → Settings → Services → Storage and choose Cloudflare R2.
- Press Connect and fill in the Account ID, the Bucket, the Access key ID and the Secret access key.
- Under Who can open files, keep Only people allowed to see the file.
- Press Test connection, then Save.

Then choose what goes to R2 under Where files go, as Storage says.
4. Uploads from the browser
With an Admin token, Configure CORS adds the rule to the bucket for you. With an Object token, add it in Cloudflare: open the bucket, Settings → CORS Policy → Add CORS policy, and paste a rule that lets your site PUT and GET, such as:
[{"AllowedOrigins": ["https://example.com"], "AllowedMethods": ["GET", "PUT", "HEAD"], "AllowedHeaders": ["*"], "ExposeHeaders": ["ETag"], "MaxAgeSeconds": 3600}]
A Worker on your own domain, if you want to
Without one, files open straight from R2 for whoever your site signed a link for. A Worker serves them from a domain of yours instead, through the network of Cloudflare:
- Turn on Serve files through a Cloudflare Worker in the dialog, and press Copy Worker script.
- In Cloudflare, under Workers & Pages, create a Worker, paste the script and deploy it.
- In the settings of the Worker, add an R2 bucket binding named
R2_BUCKETfor your bucket, and a secret namedWORKER_SECRET: press Generate beside Worker Secret in the dialog and copy it there before you save. - Connect a domain of yours to the Worker, such as
files.example.com, or use itsworkers.devaddress, and enter it as the Worker URL. Test Worker checks it.
Public files
If you choose Anyone with the link instead, files open from a public address: connect a domain to the bucket under its Settings → Custom Domains, and enter it as the Public URL. The r2.dev address Cloudflare offers is rate-limited and meant for testing.