Complete S3 setup · Cloudflare R2

Cloudflare R2 Setup Guide

Configure an R2 bucket, API token, CORS policy, and ShrimpSend settings.

When to use R2

  • S3-compatible storage with favorable egress pricing.
  • You manage your own R2 bucket and keys on Cloudflare.

Get started

  1. Sign in to the Cloudflare Dashboard.
  2. Open Build → Storage & databases → R2 object storage → Overview.
Open R2: Build → Storage & databases → R2 object storage → Overview
Open R2: Build → Storage & databases → R2 object storage → Overview

S3 API endpoint

On the R2 Overview page, under Account details:

  • Account ID — may appear in the endpoint URL.
  • S3 API — this is your ShrimpSend Endpoint (https://<accountid>.r2.cloudflarestorage.com). Use the copy button.

Click API token → Manage to create keys.

Account details: S3 API and token entry
Account details: S3 API and token entry

Create an API token

  1. Go to R2 object storage → Manage R2 API tokens (or API token → Manage from account details).
  2. For personal use, click Create User API token.
  3. Grant Object Read & Write scoped to your bucket.
  4. Save Access Key ID and Secret Access Key (secret shown once).
Create User API token
Create User API token

Create a bucket

  1. On R2 Overview, click + Create bucket.
  2. Enter a globally unique name.
  3. Keep Automatic location and Standard storage class unless you have other needs.
  4. Click Create bucket (buckets are private by default).
Create bucket entry
Create bucket entry
Create bucket form
Create bucket form

Configure CORS

Browser uploads require CORS:

  1. Open the bucket → Settings tab.
  2. Select CORS policyEdit.
  3. Paste the JSON below and save.
CORS policy: Settings → Edit
CORS policy: Settings → Edit
[
  {
    "AllowedOrigins": [
      "https://xiachuan.net",
      "https://www.xiachuan.net"
    ],
    "AllowedMethods": [
      "GET",
      "PUT",
      "POST",
      "DELETE",
      "HEAD"
    ],
    "AllowedHeaders": [
      "*"
    ],
    "ExposeHeaders": [
      "ETag",
      "Content-Length"
    ],
    "MaxAgeSeconds": 86400
  }
]
CORS JSON editor
CORS JSON editor

ShrimpSend settings

Open S3 configuration from either entry point:

  1. Settings → S3 — global config for all devices on the account.
  2. S3 cloud relay session — use S3 settings inside the session.
FieldNotes
EndpointS3 API from account details; must include https://
Regionauto
BucketYour bucket name
Path-style accessOn (usually required for R2 S3 API)
Access Key IDR2 token access key
Secret Access KeyR2 token secret
ShrimpSend S3 settings
ShrimpSend S3 settings

Test connection

Run Test connection, then send a file across networks. Check DevTools if uploads fail with CORS errors.

FAQ

Region? Use auto.

403 / signature errors? Verify token scope, endpoint, and Path-style.

Built-in S3 vs your R2? Built-in is platform-hosted; this guide is for your own R2 bucket.