Skip to content

add r2 public bucket local support#31767

Open
emily-shen wants to merge 1 commit into
productionfrom
emily/r2-public-buckets
Open

add r2 public bucket local support#31767
emily-shen wants to merge 1 commit into
productionfrom
emily/r2-public-buckets

Conversation

@emily-shen

Copy link
Copy Markdown
Contributor

Summary

this was recently added to wrangler: cloudflare/workers-sdk#14119

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ 1 warning found in commit 77bb608.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

No code review issues found.

Conventions

Checks PR title, description, and redirect checklist.

No convention issues found.

Style Guide Review

Warnings (1)
File Issue
r2/buckets/public-buckets.mdx line 151 Internal links must include a trailing slash[developing locally](/workers/local-development) omits the trailing slash Fix: Change the link to /workers/local-development/

Redirects

No missing redirect entries found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.

@github-actions github-actions Bot added product:r2 R2 object storage: https://developers.cloudflare.com/r2 size/xs labels Jun 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/r2/ @oxyjun, @elithrar, @jonesphillip, @aninibread, @harshil1712, @helloimalastair, @cloudflare/workers-docs, @cloudflare/product-owners

@ask-bonk ask-bonk Bot added documentation Documentation edits content:edit Request for content edits labels Jun 29, 2026

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR adds a concise Local development section to the R2 public-buckets documentation, covering the local-only path format, binding behavior, supported HTTP methods, and a caveat about public-access availability.

Changes

  • Adds 8 lines under a new ## Local development heading in src/content/docs/r2/buckets/public-buckets.mdx.
  • Links to the existing /workers/local-development page.
  • References the upstream wrangler change (cloudflare/workers-sdk#14119).

Issues flagged

  1. Missing trailing newline – the file currently ends without a newline (\ No newline at end of file). Please ensure the file ends with a newline.
  2. Variable placeholder casing – style guide requires ALL_CAPS_UNDERSCORES for placeholders (e.g., <BUCKET_ID> rather than <bucket-id>).
  3. Filler words / prose tightening – the closing sentence contains filler words (“or not”, “actually”, “in fact”) that can be removed for clarity.
  4. Ambiguous list structure – the sentence describing endpoint capabilities could be misread; consider splitting it.

None of these are blockers, but addressing them will bring the page in line with the docs style guide.


## Local development

When [developing locally](/workers/local-development), objects are served under `/cdn-cgi/local/r2/public/<bucket-id>/<key>`, where `<bucket-id>` is the bucket's `bucket_name` as set in your Wrangler config. If `bucket_name` is not set, this is the `binding` name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style guide: variable placeholders should use ALL_CAPS_UNDERSCORES inside angle brackets.

Please change:

  • <bucket-id><BUCKET_ID>
  • <key><KEY> (or <OBJECT_KEY>)


When [developing locally](/workers/local-development), objects are served under `/cdn-cgi/local/r2/public/<bucket-id>/<key>`, where `<bucket-id>` is the bucket's `bucket_name` as set in your Wrangler config. If `bucket_name` is not set, this is the `binding` name.

Bindings configured with `remote: true` are not exposed. The endpoint supports `GET` and `HEAD`, range requests, conditional headers, and forwards stored HTTP metadata.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list reads a little ambiguously — it sounds like the endpoint “supports … forwards stored HTTP metadata.” Consider splitting the sentence for clarity:

The endpoint supports GET and HEAD, range requests, and conditional headers. It also forwards stored HTTP metadata.


Bindings configured with `remote: true` are not exposed. The endpoint supports `GET` and `HEAD`, range requests, conditional headers, and forwards stored HTTP metadata.

Note this is always available locally, regardless of whether or not you have actually enabled public access for this bucket. Recall that by default, buckets are in fact _not_ publicly accessible over the Internet. No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider tightening this to remove filler words and improve readability:

Note that this endpoint is always available locally, regardless of whether you have enabled public access for the bucket. By default, buckets are not publicly accessible over the Internet.

(You could also wrap this in a :::note admonition since it is supplementary info.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ this

@ask-bonk

ask-bonk Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review completed for PR #31767

  • Labels applied: documentation, content:edit
  • Review type: REQUEST_CHANGES (with inline comments)

What the PR changes

Adds a new Local development section (8 lines) to src/content/docs/r2/buckets/public-buckets.mdx that documents the local-only public-bucket path (/cdn-cgi/local/r2/public/<bucket-id>/<key>), binding behavior, supported HTTP methods, and a note about availability regardless of actual public-access state.

Issues flagged

  1. Missing trailing newline – the file ends without a newline (\ No newline at end of file).
  2. Variable placeholder casing – style guide requires ALL_CAPS_UNDERSCORES (e.g., <BUCKET_ID> instead of <bucket-id>).
  3. Filler words – the closing sentence uses “or not”, “actually”, and “in fact”, which can be tightened.
  4. Ambiguous list structure – the endpoint-capabilities sentence could be misread; splitting it improves clarity.

Inline suggestions posted

  • Line 151: Replace <bucket-id><BUCKET_ID> and <key><KEY>.
  • Line 153: Split the capabilities sentence for clarity.
  • Line 155: Remove filler words and optionally convert the paragraph to a :::note admonition.

No blockers were identified; addressing the style points should make this ready to merge.

github run

@github-actions

Copy link
Copy Markdown
Contributor

@MattieTK MattieTK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this Emily, a few minor nits from the reviewer that I think are useful in condensing the language.


Bindings configured with `remote: true` are not exposed. The endpoint supports `GET` and `HEAD`, range requests, conditional headers, and forwards stored HTTP metadata.

Note this is always available locally, regardless of whether or not you have actually enabled public access for this bucket. Recall that by default, buckets are in fact _not_ publicly accessible over the Internet. No newline at end of file

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content:edit Request for content edits documentation Documentation edits product:r2 R2 object storage: https://developers.cloudflare.com/r2 size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants