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 — and this tutorial walks you 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; the other settings can stay at their default. Save your Bucket name elsewhere, as it will be needed later. Create a bucket by clicking on the Create Bucket button.

Bucket name form

5) Switch to the Settings tab, and under General, you will see the Public Development URL. Enable this option by clicking on the Enable button.

Enable Public Development URL

The Public Development URL will be displayed below. Save this URL elsewhere, as you will need it later.

Public Development URL displayed

6) On the same page below the Public Development URL, you will also see the CORS Policy option. Click on the + Add button 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 your Account ID elsewhere, as you will need it later.

9) Generate a User API token. First, navigate to a page on this link: https://dash.cloudflare.com/?to=/:account/r2/api-tokens. There, click on the Create User API token button to display the Create User API Token interface.

Create User API token

In the Create User API Token interface, fill out your Token name, set Permissions to Object Read & Write, and click on the Create User API Token button.

Token permissions

Once created, you will have a one-time access to the Access Key ID and Secret Access Key. Save both of them elsewhere, as you will need them later.

Access Key ID and Secret Access Key

10) Go to your Topol account, navigate to Plugin, and set the Storage option of a specific Active API token to Cloudflare R2.

Topol Storage options dialog

11) A modal will pop up, prompting you to enter all necessary data that you have been saving throughout this setup process:

  • Bucket name
  • Account ID
  • Access key
  • Secret key
  • Public URL

Fill in all the required fields and click the Update custom storage button.

Fill in Cloudflare R2 credentials

Your Cloudflare R2 storage setup is now complete.

If you encounter any issues or require additional instructions, please don't hesitate to contact our support.