[wrangler][miniflare] Serve local R2 bucket objects publicly via /cdn-cgi/mf/r2#14119
[wrangler][miniflare] Serve local R2 bucket objects publicly via /cdn-cgi/mf/r2#14119tahmid-23 wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 85bbe76 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
5de38c1 to
3bd48b7
Compare
|
Thank you for this PR @tahmid-23. |
|
@NuroDev makes sense. |
Feel free to implement that yourself here, and if we can help with anything let us know 😄 |
3bd48b7 to
12cdc58
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
cea5c3f to
eca9313
Compare
Accept and validate the experimental_local_public boolean on R2 bucket bindings in wrangler config. Gated as experimental. No runtime behavior attached yet — wiring lands in the next commit. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces the use of the shared `namespaceEntries` helper in the R2 plugin with a local `r2BucketEntries` typed against `R2OptionsSchema`. No behavior change — the new helper produces the same shape — but a local helper lets future R2-specific fields be threaded through without expanding the shared helper used by other namespace-style plugins. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…-cgi/mf/r2 Exposes opted-in local R2 buckets at <dev-server>/cdn-cgi/mf/r2/<binding>/<key> on the existing user-facing dev server, dispatched through the entry worker (same pattern as the stream binding). Subject to the existing /cdn-cgi/* Host/Origin allowlist. Enabled per-binding via experimental_local_public: true on R2 bindings in wrangler config. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
eca9313 to
85bbe76
Compare
|
@NuroDev done |
This implements the idea discussed in #13325.
R2 exposes a public endpoint for accessing buckets remotely, but no such analogue exists in local development.
This adds a configuration parameter,
experimental_local_port, that sets up a socket for a given R2 binding. This is sent to a custom worker, which translates aGET/HEADrequest into an R2 access. The worker provides full support for range and condition headers.As a brief aside, I'd like to implement S3-compatible pre-signed uploads in the newly created worker in a follow-up PR.
A picture of a cute animal (not mandatory, but encouraged)