Skip to content

Custom Cloudflare R2 Storage

The Custom storage feature is available with the Plugin Expansion plan and higher.

If you're on the Plugin for Startup plan, consider upgrading to access this feature. For more details, visit our pricing page or contact support.

The Custom Cloud Storage feature in the Topol Plugin lets you connect your own storage provider. Alongside AWS S3, Google Cloud Storage, and DigitalOcean Spaces, you can also use Cloudflare R2 Storage. This tutorial walks through that setup step by step.

Throughout this guide, you will collect several values that you'll need at the very end (your bucket name, public URL, account ID, access key, and secret key). Save each one somewhere safe as you go.

How to configure Custom Cloudflare R2 Storage

1) Sign up at https://dash.cloudflare.com/sign-up/r2.

2) Navigate to R2 Object Storage -> Overview.

R2 Object Storage Overview

3) Create a bucket by clicking the + Create bucket button.

Create bucket button

4) Enter your Bucket name and leave the other settings at their defaults, then click Create Bucket. Save the bucket name for the final step.

Bucket name form

5) Switch to the Settings tab. Under General there is a Public Development URL option; enable it by clicking Enable.

Enable Public Development URL

The Public Development URL is then displayed below. Save it for the final step.

Public Development URL displayed

6) Below the Public Development URL on the same page is the CORS Policy section. Click + Add to add a custom policy.

CORS Policy Add

7) Add the following code to the displayed console and save it by clicking the Save button.

json
[
  {
    "AllowedOrigins": [
      "https://d5aoblv5p04cg.cloudfront.net",
      "https://o6lwlm3sld.execute-api.eu-west-1.amazonaws.com",
      "https://v3.develop.email-assets.topol.io",
      "https://v3.email-assets.topol.io",
      "https://v4.develop.email-assets.topol.io",
      "https://v4.email-assets.topol.io"
    ],
    "AllowedMethods": [
      "PUT",
      "GET",
      "HEAD"
    ],
    "AllowedHeaders": [
      "content-type",
      "x-goog-acl"
    ],
    "ExposeHeaders": [
      "ETag"
    ],
    "MaxAgeSeconds": 3600
  }
]

8) Get your Account ID from your Dashboard URL. It is always the long hex string immediately after dash.cloudflare.com/

https://dash.cloudflare.com/<your-account-ID>/...

Save it for the final step.

9) Generate a User API token at https://dash.cloudflare.com/?to=/:account/r2/api-tokens. There, click Create User API token.

Create User API token

Fill out your Token name, set Permissions to Object Read & Write, and click Create User API Token.

Token permissions

The Access Key ID and Secret Access Key are shown only once. Save both for the final step.

Access Key ID and Secret Access Key

Set your Cloudflare R2 credentials for the API Token in TOPOL

The remaining steps happen in the Topol app, using the values you saved above.

1) Log in to your Topol account at https://app.topol.io/. The API Tokens tab is selected by default.

2) Select the API Token where you want to set up your own Cloudflare R2 storage and switch to the Configuration tab.

3) In the Custom storage section, click Set up Cloudflare R2 storage.

Custom storage section in the API Token Configuration tab

4) A modal will appear. Fill in the values you saved during the setup:

  • Bucket name: the bucket you created earlier.
  • Account ID: the account ID from your Dashboard URL.
  • Access key: the Access Key ID from your User API token.
  • Secret key: the Secret Access Key from your User API token.
  • Public URL: the Public Development URL of your bucket.
  • Jurisdiction (optional): fill this in only if you created your bucket under a specific jurisdiction (for example, eu).
Set up your own Cloudflare R2 bucket modal

5) Click Finish setup.

Setup complete. The plugin now uploads files to your R2 bucket.

If you hit any issues, contact our support.