Skip to main content
Your images stay in your R2 bucket. Dreep resizes them when they’re requested.
Needs the Pro plan.

1. Create an R2 key

  1. In Cloudflare, open R2 Object Storage and click Manage API Tokens.
R2 Object Storage overview with the Manage API Tokens button
  1. Click Create Account API token.
R2 API Tokens page with the Create Account API token button
  1. Choose Object Read & Write, then Apply to specific buckets only and pick your bucket.
Creating a token with Object Read & Write on one bucket
  1. Create the token, then copy the Access Key ID, Secret Access Key and the S3 endpoint. The secret is only shown once.

2. Connect the bucket

  1. In Dreep, open your project, go to Settings > Storage and click Configure Bucket.
Dreep storage settings with the Configure Bucket button
  1. Choose Cloudflare R2 and click Continue.
Choosing Cloudflare R2 as the provider
  1. Paste the bucket name, keys and S3 endpoint. Leave the region as auto.
Bucket name, keys and endpoint form
  1. Click Review & Test, then connect the bucket. When it’s done, you’ll see Connected.
Connected bucket with the setup checklist complete

3. Use your images

Copy the Images URL from your bucket details, then add a file’s path from your bucket:
Add options to resize or convert it:

Options

See Image Transformations for everything else.

Move your image URLs

Your Cloudflare Images links work on Dreep with the same options and the same file paths. Only the start of the URL changes. On Dreep’s domain, swap the domain for your Images URL:
On your own domain (see below), keep the domain and swap /cdn-cgi/image/ for /_img/. Cloudflare reserves /cdn-cgi/ on every domain it serves, so that path never reaches Dreep:
Links without options, like https://images.example.com/products/123/photo.jpg, need no change on your own domain.

In your code

If your app builds image URLs, change them in one place. The JavaScript SDK has toDreepUrl() built in:

In your database

If you store full image URLs, update them in place. Back up the table first.
PostgreSQL / MySQL
If you’re keeping your own domain, skip the first REPLACE and only swap /cdn-cgi/image/ for /_img/. The same goes for links on R2’s development URL (https://pub-….r2.dev): put that as the old base.

Optional: your own domain

  1. If the domain is connected to your R2 bucket, remove it there first: your bucket > Settings > Custom Domains.
  2. In Dreep, go to Settings > Custom Domains and add the domain, such as images.example.com.
  3. Add the DNS record Dreep shows you.
Your images are then at:

Optional: CORS for browser uploads

Only needed if your website uploads files from the browser straight to your bucket. Serving and resizing images works without it.
  1. In Cloudflare, open your bucket and go to Settings. Under CORS Policy, click Add.
R2 bucket settings with the CORS Policy section
  1. Paste this policy, with your website’s address in AllowedOrigins, then click Save.
R2 CORS policy editor with the policy pasted in
  1. Back in Dreep, click Verify Again in the setup checklist. S3 CORS Configuration shows Configured.