Skip to content

Cloudflare R2

Cloudflare R2 is an S3-compatible object storage service with no egress fees. Sairo connects to R2 using its S3 API endpoint.

environment:
S3_ENDPOINT: "https://<account-id>.r2.cloudflarestorage.com"
S3_ACCESS_KEY: "your-r2-access-key-id"
S3_SECRET_KEY: "your-r2-secret-access-key"
S3_REGION: "auto"
S3_PATH_STYLE: "true"
VariableValueNotes
S3_ENDPOINThttps://<account-id>.r2.cloudflarestorage.comReplace <account-id> with your Cloudflare account ID
S3_REGIONautoR2 uses auto as the region
S3_PATH_STYLEtrueR2 requires path-style addressing

Your Cloudflare account ID is in the URL when you visit the R2 dashboard:

https://dash.cloudflare.com/<account-id>/r2

It is also shown on the R2 overview page under Account ID.

  1. Go to the Cloudflare dashboard
  2. Navigate to R2 > Overview
  3. Click Manage R2 API Tokens in the right sidebar
  4. Click Create API token
  5. Set permissions to Object Read & Write
  6. Optionally restrict to specific buckets
  7. Click Create API Token
  8. Copy the Access Key ID and Secret Access Key

Use the Access Key ID as S3_ACCESS_KEY and the Secret Access Key as S3_SECRET_KEY.

services:
sairo:
image: stephenjr002/sairo:latest
ports:
- "8000:8000"
environment:
S3_ENDPOINT: "https://abc123def456.r2.cloudflarestorage.com"
S3_ACCESS_KEY: "your-r2-access-key-id"
S3_SECRET_KEY: "your-r2-secret-access-key"
S3_REGION: "auto"
S3_PATH_STYLE: "true"
ADMIN_PASS: "change-me"
volumes:
- sairo-data:/data
volumes:
sairo-data:

Cloudflare R2 does not support all S3 features. The following Sairo features are affected:

FeatureStatus
Browse, upload, download, deleteFully supported
Search and indexingFully supported
Share linksFully supported
Bucket versioningNot supported by R2
Lifecycle rulesLimited support
Bucket policyNot supported by R2
CORS configurationSupported via Cloudflare dashboard

Sairo gracefully handles unsupported features. The corresponding settings tabs will show a message indicating the feature is not available for this storage provider.