Skip to content

Remove loopback for Router worker#14418

Open
matthewdavidrodgers wants to merge 3 commits into
mainfrom
router-worker-outer-entrypoint-class
Open

Remove loopback for Router worker#14418
matthewdavidrodgers wants to merge 3 commits into
mainfrom
router-worker-outer-entrypoint-class

Conversation

@matthewdavidrodgers

@matthewdavidrodgers matthewdavidrodgers commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Fixes WC-5346.

Bypass the router Worker loopback on the normal request path

The inner routing entrypoint is now the default, avoiding the latency added by forwarding every request through ctx.exports. The outer loopback entrypoint and its supporting infrastructure remain available as named exports in the router Worker, Miniflare, and Vite plugin bundles so the boundary can be re-enabled later.


  • 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: internal only change

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


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 716cfd9

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

This PR includes changesets to release 7 packages
Name Type
@cloudflare/workers-shared Patch
miniflare Patch
@cloudflare/vite-plugin Patch
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
wrangler Patch
@cloudflare/vitest-pool-workers Patch

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

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jun 24, 2026
@workers-devprod workers-devprod requested review from a team and NuroDev and removed request for a team June 24, 2026 20:39
@workers-devprod

workers-devprod commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/deploy-config
  • ✅ @cloudflare/wrangler
Show detailed file reviewers
  • packages/workers-shared/router-worker/src/worker.ts: [@cloudflare/deploy-config]
  • packages/workers-shared/router-worker/tests/index.test.ts: [@cloudflare/deploy-config]

@github-actions

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

The behavior of RouterOuterEntrypoint is preserved exactly across the commits (the only change in this PR's final state is making RouterInnerEntrypoint the default instead of RouterOuterEntrypoint). The refactor is sound.

The change is clean: the default export now points to the inner entrypoint directly (bypassing loopback), and the outer entrypoint remains exported for re-enabling later. The miniflare and vite re-export files correctly add RouterOuterEntrypoint to preserve the loopback binding in bundles. Tests cover all three behaviors (default identity, direct routing, loopback availability).

No logic bugs, security issues, backward-compat violations, or incorrect API behavior found. The trailing-comma changes are formatting (out of scope).

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14418

create-cloudflare

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

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14418

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-shared

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

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14418

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14418

wrangler

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

commit: 716cfd9

@devin-ai-integration devin-ai-integration 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@matthewdavidrodgers matthewdavidrodgers force-pushed the router-worker-outer-entrypoint-class branch from fb1c0da to c77b71f Compare June 24, 2026 21:51

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +7 to +9
Bypass the router Worker loopback on the normal request path

The inner routing entrypoint is now the default, avoiding the latency added by forwarding every request through `ctx.exports`. The outer loopback entrypoint and its supporting infrastructure remain available as named exports in the router Worker, Miniflare, and Vite plugin bundles so the boundary can be re-enabled later.

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.

🟡 Changeset description contains implementation details instead of user-facing impact

REVIEW.md states: "Changesets should target users of the tools (e.g. Wrangler users) rather than maintainers. Avoid including implementation details like 'moves X from hybridModules to nativeModules' or 'removes polyfill implementation' or 'adds comprehensive tests'. Instead, focus on user-facing impact and benefits." The changeset title "Bypass the router Worker loopback on the normal request path" and body mentioning "inner routing entrypoint", "ctx.exports", "outer loopback entrypoint", and "named exports in the router Worker, Miniflare, and Vite plugin bundles" are all implementation details. The user-facing benefit (reduced latency / improved performance) should be the focus instead.

Suggested change
Bypass the router Worker loopback on the normal request path
The inner routing entrypoint is now the default, avoiding the latency added by forwarding every request through `ctx.exports`. The outer loopback entrypoint and its supporting infrastructure remain available as named exports in the router Worker, Miniflare, and Vite plugin bundles so the boundary can be re-enabled later.
Improve routing performance for Workers with assets
Reduce request handling latency by streamlining the router Worker's request path. The loopback infrastructure remains available for future use.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@NuroDev NuroDev 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.

LGTM apart from Devin's comment on the changeset description

@matthewdavidrodgers matthewdavidrodgers force-pushed the router-worker-outer-entrypoint-class branch from c77b71f to 716cfd9 Compare June 25, 2026 20:32

@dario-piotrowicz dario-piotrowicz 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.

Codeowners Bypass

@workers-devprod workers-devprod 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.

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

4 participants