Skip to content

refactor(miniflare): centralize internal paths and move platform proxy endpoint#12686

Open
edmundhung wants to merge 5 commits intomainfrom
edmundhung/refactor-platform-proxy-api
Open

refactor(miniflare): centralize internal paths and move platform proxy endpoint#12686
edmundhung wants to merge 5 commits intomainfrom
edmundhung/refactor-platform-proxy-api

Conversation

@edmundhung
Copy link
Member

@edmundhung edmundhung commented Feb 26, 2026

Fixes n/a.

This is just an internal refactor to centralize all our /cdn-cgi paths. No behavior changes.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: refactor only

A picture of a cute animal (not mandatory, but encouraged)


Open with Devin

@edmundhung edmundhung requested a review from a team as a code owner February 26, 2026 17:09
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

🦋 Changeset detected

Latest commit: db29394

The changes in this PR will be included in the next version bump.

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

@claude
Copy link
Contributor

claude bot commented Feb 26, 2026

Claude encountered an error —— View job


Changeset Review

  • Read changeset guidelines
  • Review .changeset/brave-planes-dance.md
  • Validate against criteria
  • Check image attachment
  • Provide feedback

devin-ai-integration[bot]

This comment was marked as resolved.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 26, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12686

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12686

miniflare

npm i https://pkg.pr.new/miniflare@12686

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12686

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12686

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12686

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12686

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12686

wrangler

npm i https://pkg.pr.new/wrangler@12686

commit: 61e877c

@edmundhung edmundhung force-pushed the edmundhung/refactor-platform-proxy-api branch from 9dd796d to 88422f3 Compare February 26, 2026 17:20
devin-ai-integration[bot]

This comment was marked as resolved.

@edmundhung edmundhung self-assigned this Feb 27, 2026
@edmundhung edmundhung force-pushed the edmundhung/refactor-platform-proxy-api branch 2 times, most recently from c54485a to dcd3868 Compare March 2, 2026 14:14
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

✅ All changesets look good

devin-ai-integration[bot]

This comment was marked as resolved.

@edmundhung edmundhung force-pushed the edmundhung/refactor-platform-proxy-api branch from 9f2df6b to dc11845 Compare March 4, 2026 19:50
@workers-devprod
Copy link
Contributor

workers-devprod commented Mar 4, 2026

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • packages/miniflare/src/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/core/constants.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/core/proxy/client.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/core/proxy/fetch-sync.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/core/constants.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/core/entry.worker.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/core/proxy.worker.ts: [@cloudflare/wrangler]
  • packages/miniflare/test/plugins/core/proxy/client.spec.ts: [@cloudflare/wrangler]

@edmundhung edmundhung force-pushed the edmundhung/refactor-platform-proxy-api branch from 5c3c95a to db29394 Compare March 4, 2026 22:37
const request = new Request(this.bridge.url, userRequest);
// If adding new headers here, remember to `delete()` them in `ProxyServer`
// before calling `fetch()`.
request.headers.set(CoreHeaders.OP_ORIGINAL_URL, userRequest.url);
Copy link
Member Author

Choose a reason for hiding this comment

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

This preserves the caller's original fetch URL because request.url is now rewritten to /cdn-cgi/platform-proxy before proxy dispatch.

try {
if (dispatcherUrl !== url) {
dispatcherUrl = url;
dispatcher = new Pool(new URL(url).origin, {
Copy link
Member Author

Choose a reason for hiding this comment

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

undici Pool expects a request origin instead of full URL: https://undici.nodejs.org/#/docs/api/Pool?id=class-pool

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

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants