Replace R2 llms-full.txt with middlecache proxy (request-time)#29301
Merged
mvvmm merged 4 commits intoproductionfrom Mar 25, 2026
Merged
Replace R2 llms-full.txt with middlecache proxy (request-time)#29301mvvmm merged 4 commits intoproductionfrom
mvvmm merged 4 commits intoproductionfrom
Conversation
Replaces the VENDORED_MARKDOWN R2 bucket binding with a request-time proxy to middlecache. The worker now fetches llms-full.txt files from https://middlecache.ced.cloudflare.com/v1/cloudflare-docs-llms-full/ and streams the response to the client. This removes the dependency on the vendored-markdown R2 bucket.
Contributor
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Contributor
|
Preview URL: https://0974ea60.preview.developers.cloudflare.com |
Replace the HTTP proxy to middlecache with a direct R2 binding to the middlecache bucket (same account). This eliminates the HTTP overhead (DNS, TLS, connection) and reads directly from R2 via internal IPC, which is faster especially for the ~40 MB root llms-full.txt.
R2 bindings only work for Workers deployed in the same account. External contributors running npm run dev locally would get empty R2 simulations and 404s for all llms-full.txt requests. Revert to HTTP fetch from the public middlecache URL which works for everyone.
The request-time branch is a production-only approach — all llms-full.txt requests go through the Worker, so using the R2 binding (direct IPC, no HTTP overhead) is the right choice here. Local dev for this branch would require the same account access regardless.
kodster28
approved these changes
Mar 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VENDORED_MARKDOWNR2 bucket binding with aMIDDLECACHER2 binding pointing to themiddlecachebucket (same account)v1/cloudflare-docs-llms-full/{path}Approach
Request-time R2 read: When a request for
/llms-full.txtor/{product}/llms-full.txtarrives, the worker maps the pathname to an R2 key (e.g./workers/llms-full.txt→v1/cloudflare-docs-llms-full/workers/llms-full.txt) and reads directly from themiddlecacheR2 bucket. This is a local IPC call with no DNS/TLS/HTTP overhead.This is one of two approaches being tested — compare with #29302 which fetches per-product files at build time and serves them as static assets.
Changes
worker/index.ts— Replace R2.get()onVENDORED_MARKDOWNwith.get()onMIDDLECACHEusing thev1/cloudflare-docs-llms-full/key prefix, with 404 handlingwrangler.toml— ReplaceVENDORED_MARKDOWN→vendored-markdownbinding withMIDDLECACHE→middlecachebindingworker/worker-configuration.d.ts— ReplaceVENDORED_MARKDOWN: R2BucketwithMIDDLECACHE: R2BucketinEnvinterface