Open R2 and create your bucket
- 1. Open Cloudflare dashboard.
- 2. Go to Storage and databases, then R2 Object Storage, then Overview.
- 3. Click Create bucket.
- 4. Name the bucket (example: fircle-media) and create it.
This page is the in-depth setup reference for Step 1 in the self-hosting guide. It includes exact UI path guidance, credential mapping, and a post-deployment CORS step.
R2_ACCOUNT_ID="[ACCOUNT_ID]"
R2_BUCKET="fircle-media"
R2_ACCESS_KEY_ID="[ACCESS_KEY_ID]"
R2_SECRET_ACCESS_KEY="[SECRET_ACCESS_KEY]"
R2_PUBLIC_BASE_URL="https://[PUBLIC_BUCKET_DOMAIN]"Configure CORS after deployment so you can use your final app domain. Copy the policy below, replace the domain placeholder, and paste it into the CORS settings for the bucket.
[
{
"AllowedOrigins": [
"[DOMAIN URL]"
],
"AllowedMethods": [
"GET",
"PUT",
"HEAD"
],
"AllowedHeaders": [
"content-type"
]
}
]Why this is post-deployment
CORS should reference the final deployed origin. Setting it too early can leave placeholder domains that fail in production.