---
title: "Cloudflare R2 Setup"
url: "https://fileflare.io/docs/cloudflare-r2/"
description: "Connect Cloudflare R2 to Fileflare — the cheapest S3-compatible option, with free unlimited egress for Shopify digital downloads."
published: "2026-03-27T16:32:32+00:00"
modified: "2026-10-26T21:23:43+00:00"
---

Cloudflare R2 is the cheapest S3-compatible storage option that works with Fileflare. Free up to 10 GB, around $15/TB after that, and — unlike AWS — no bandwidth charges, ever. For most stores, R2 is the right “bring your own storage” choice.

Available on the Growth plan and higher. R2 connects via Fileflare’s custom-S3 settings since it’s S3-compatible. Files on R2 don’t count toward your Fileflare storage quota.

## When you’d use this

- You sell large digital files and want to control storage costs.
- You want unlimited download bandwidth without worrying about egress fees.
- You’re already on Cloudflare and want files alongside Workers, Pages, etc.

## Set up R2

### 1. Sign up and add billing

1. Sign in to [Cloudflare](https://dash.cloudflare.com/).
2. Click **R2** in the left navigation.
3. Add billing details (free tier exists, but billing is required to enable).

### 2. Create a bucket

1. Click **Create bucket**.
2. Pick a name (lowercase, no spaces).
3. Save.

Keep the bucket private. Fileflare delivers every download through a signed link that expires, so you don’t need public access, the `r2.dev` subdomain, or a custom domain on the bucket.

### 3. Copy the S3 API endpoint

In your bucket’s **Settings**, copy the **S3 API** URL and remove the bucket name from the end. It looks like `https://<account-id>.r2.cloudflarestorage.com`. You’ll paste this into Fileflare’s **Endpoint** field.

### 4. Set CORS

Uploads go straight from your browser to the bucket, so R2 has to allow them.

1. In Fileflare, go to **Settings » File storage**, click **Add connection**, and copy the **CORS config** shown at the bottom of the form.
2. In Cloudflare, open your bucket’s **Settings**, scroll to **CORS policy**, and click **Add CORS policy**.
3. Paste the config exactly as Fileflare shows it, and save.

Keep `*` as the allowed origin and `ETag` in the exposed headers. Large files upload in parts, and those uploads fail without `ETag`.

If the bucket already has CORS rules, you can keep uploads and downloads in separate rules instead: one that allows `PUT` and exposes `ETag`, and one that allows `GET`. Either way, the bucket must allow `GET`, because your customers’ online file viewer reads files with it.

### 5. Create an API token

1. In R2, click **Manage R2 API Tokens**, then **Create API token**.
2. Choose **Object Read & Write** permissions.
3. Apply the token to your Fileflare bucket only (**Apply to specific buckets only**). Fileflare only lists, uploads, downloads, and deletes files in that bucket, so it doesn’t need admin or account-wide access.
4. Click **Create**.
5. Copy the **Access Key ID** and **Secret Access Key**. Cloudflare only shows the secret once.

## Connect Fileflare to R2

In Fileflare, go to **Settings » File storage** and click **Add connection**:

- **Provider**: choose **Cloudflare R2**.
- **Bucket**: your R2 bucket name.
- **Region**: set to `auto` for you. R2 doesn’t use per-bucket regions.
- **Folder**: the folder Fileflare stores new files in, such as `fileflare` or your store name. This one’s required.
- **Endpoint**: the S3 API URL from step 3, without the bucket name.
- **Access key**: paste the R2 Access Key ID.
- **Secret key**: paste the R2 Secret Access Key.

Leave **Use path style endpoint** off. R2 works either way, so there’s no reason to turn it on.

Click **Add connection**. Fileflare tests the connection before it saves.

### Test with an upload

An Object Read & Write token can’t read the bucket’s CORS policy, so the connection test can’t check it for you. Right after connecting, upload a file from the **Assets** page. If it goes through, you’re done. If it fails, recheck the CORS policy from step 4.

## Connection options

Same options apply as on AWS S3 — see [the S3 doc](/docs/amazon-s3/) for path-style endpoint, delete sync, and rename-on-upload details.

## Common issues

- **Upload fails with a CORS error** — copy the CORS config from Fileflare again and paste it into the bucket’s CORS policy unchanged. Check that the allowed origin is `*` and `ETag` is an exposed header.
- **“Unable to connect to S3 bucket”** — check the endpoint (the S3 API URL, without the bucket name), the bucket name, and both keys.
- **Upload fails with access denied** — the token needs **Object Read & Write** on this bucket. A read-only token can’t upload.

## Keep learning

- [Connect Amazon S3](/docs/amazon-s3/)
- [Other upload methods](/docs/methods-to-upload-add-files-to-fileflare/)
- [Storage tiers and quotas](/docs/how-much-storage-can-i-get/)
