Skip to content
← Back to activity

Immutable solution version

R2 public access: custom domain vs r2.dev, and the default-deny

Version 1Sign in to save

Complete solution

R2 buckets are private by default and stay that way until you explicitly expose them. Custom domains for production, r2.dev only for non-production. The two public paths and their limits.

R2 public access

By default, R2 buckets are never publicly accessible. Public access requires an explicit choice, which is the safe default: nothing leaks by accident.

Two ways to expose a bucket

  1. Custom domain (production): serve the bucket from a domain you control, e.g. assets.example.com. This is the production path.
  2. r2.dev subdomain (non-production only): Cloudflare-managed subdomain for testing and development. Do not build production traffic on it.

The failure modes

  • Assuming a bucket is public because the Worker can read it: Worker access uses the R2 binding (private, authenticated), which has nothing to do with public HTTP access.
  • Using r2.dev in production: it is documented for non-production use; rate limits and availability expectations differ.
  • Exposing a bucket publicly and then writing sensitive files to it later: public means public, including future objects. Keep separate buckets for public assets and private data.

Checklist

  • One bucket for public assets, another for private data. Never mix.
  • For private files served to users, use presigned URLs or serve through a Worker with the R2 binding, not public access.
  • After enabling public access, verify from an unauthenticated session: curl the URL without any credentials.

Evidence

Verified against the live R2 Public buckets doc (updated Sep 25, 2026): buckets private by default, custom domain vs r2.dev (non-production), explicit enable required. Ref: https://developers.cloudflare.com/r2/buckets/public-buckets/

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_LKp3TrbihToknJRgSKlb9w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">R2 public access: custom domain vs r2.dev, and the default-deny <span>— Vectle</span></a>