Public buckets
Public Bucket is a feature that allows users to expose the contents of their R2 buckets directly to the Internet. By default, buckets are never publicly accessible and will always require explicit user permission to enable.
Public buckets can be set up in either one of two ways:
- Expose your bucket as a custom domain under your control.
- Expose your bucket using a Cloudflare-managed
https://r2.dev
subdomain for non-production use cases.
These options can be used independently. Enabling custom domains does not require enabling r2.dev
access.
To use features like WAF custom rules, caching, access controls, or bot management, you must configure your bucket behind a custom domain. These capabilities are not available when using the r2.dev
development url.
Domain access through a custom domain allows you to use Cloudflare Cache to accelerate access to your R2 bucket.
Configure your cache to use Smart Tiered Cache to have a single upper tier data center next to your R2 bucket.
To restrict access to your custom domain's bucket, use Cloudflare's existing security products.
- Cloudflare Zero Trust Access: Protects buckets that should only be accessible by your teammates.
- Cloudflare WAF Token Authentication: Restricts access to documents, files, and media to selected users by providing them with an access token.
To specify the minimum TLS version of a custom hostname of an R2 bucket, you can issue an API call to edit R2 custom domain settings.
The domain being used must have been added as a zone in the same account as the R2 bucket.
- If your domain is already managed by Cloudflare, you can proceed to Connect a bucket to a custom domain.
- If your domain is not managed by Cloudflare, you need to set it up using a partial (CNAME) setup to add it to your account.
Once the domain exists in your Cloudflare account (regardless of setup type), you can link it to your bucket.
- Go to R2 and select your bucket.
- On the bucket page, select Settings.
- Under Custom Domains, select Add.
- Enter the domain name you want to connect to and select Continue.
- Review the new record that will be added to the DNS table and select Connect Domain.
Your domain is now connected. The status takes a few minutes to change from Initializing to Active, and you may need to refresh to review the status update. If the status has not changed, select the ... next to your bucket and select Retry connection.
To view the added DNS record, select ... next to the connected domain and select Manage DNS.
Disabling a domain will turn off public access to your bucket through that domain. Access through other domains or the managed r2.dev
subdomain are unaffected.
The specified domain will also remain connected to R2 until you remove it or delete the bucket.
To disable a domain:
- In R2, select the bucket you want to modify.
- On the bucket page, Select Settings, go to Custom Domains.
- Next to the domain you want to disable, select ... and Disable domain.
- The badge under Access to Bucket will update to Not allowed.
Removing a custom domain will disconnect it from your bucket and delete its configuration from the dashboard. Your bucket will remain publicly accessible through any other enabled access method, but the domain will no longer appear in the connected domains list.
To remove a domain:
- In R2, select the bucket you want to modify.
- On the bucket page, Select Settings, go to Custom Domains.
- Next to the domain you want to disable, select ... and Remove domain.
- Select ‘Remove domain’ in the confirmation window. This step also removes the CNAME record pointing to the domain. You can always add the domain again.
Expose the contents of this R2 bucket to the internet through a Cloudflare-managed r2.dev subdomain. This endpoint is intended for non-production traffic.
When you enable public development URL access for your bucket, its contents become available on the internet through a Cloudflare-managed r2.dev
subdomain.
To enable access through r2.dev
for your buckets:
- In R2, select the bucket you want to modify.
- On the bucket page, select Settings.
- Under Public Development URL, select Enable.
- In Allow Public Access?, confirm your choice by typing ‘allow’ to confirm and select Allow.
- You can now access the bucket and its objects using the Public Bucket URL.
To verify that your bucket is publicly accessible, check that Public URL Access shows Allowed in you bucket settings.
Disabling public development URL access removes your bucket’s exposure through the r2.dev
subdomain. The bucket and its objects will no longer be accessible via the Public Bucket URL.
If you have connected other domains, the bucket will remain accessible for those domains.
To disable public access for your bucket:
- In R2, select the bucket you want to modify.
- On the bucket page, select Settings.
- Under Public Development URL, select Disable.
- In Disallow Public Access?, type ‘disallow’ to confirm and select Disallow.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark