Cloudflare R2 Configuration
Cloudflare R2 Configuration Guide
Section titled “Cloudflare R2 Configuration Guide”Cloudflare R2 is an S3-compatible object storage service. Its biggest advantage is zero egress fees, making it an ideal choice for Obsidian multi-device sync and cloud hyperlinks.
Prerequisites
Section titled “Prerequisites”- Log in to the Cloudflare Dashboard.
- Select R2 from the left menu.
- First-time users may need to bind a credit card or PayPal for identity verification (R2 has a generous free tier: 10GB storage, 1M Class A operations, 10M Class B operations per month).
Step 1: Create a Bucket
Section titled “Step 1: Create a Bucket”- Click Create bucket.
- Enter a bucket name (e.g.,
my-obsidian-vault). - Choose a region close to you (or keep the default Automatic).
- Click Create bucket.
Step 2: Get API Credentials
Section titled “Step 2: Get API Credentials”- Return to the R2 home page and click Manage R2 API Tokens on the right.
- Click Create API token.
- Set permissions to Edit (read and write).
- Set TTL to
Foreveror your preferred duration. - Click Create API Token.
- Important: Save the generated
Access Key IDandSecret Access Key.
Step 3: Configure in Sync Vault
Section titled “Step 3: Configure in Sync Vault”Open the Sync Vault settings in Obsidian, choose S3 mode, and fill in the following:
| Field | Value |
|---|---|
| Endpoint | https://<ACCOUNT_ID>.r2.cloudflarestorage.com |
| Region | auto |
| Bucket | Your bucket name |
| Access Key | Your Access Key ID |
| Secret Key | Your Secret Access Key |
Tip: Your
<ACCOUNT_ID>can be found in the right sidebar of the R2 home page.
Step 4: Configure CORS (Critical)
Section titled “Step 4: Configure CORS (Critical)”To allow desktop and mobile clients to access R2, you must configure CORS:
- Go to your bucket → Settings tab.
- Find CORS Policy → Click Add CORS policy.
- Paste the following JSON:
[ { "AllowedOrigins": [ "app://obsidian.md", "capacitor://localhost", "http://localhost" ], "AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"], "AllowedHeaders": ["*"], "ExposeHeaders": ["ETag"] }]- Save the policy.
Once configured, click “Test Connection” in Sync Vault. A successful test means you are ready to go.