fix(proxy): route wildcard subdomains to the closest registered parent - #4
Merged
Merged
Conversation
The wildcard tier of findRoute chose among every registered parent of the request hostname by path length only. The result depended on routes.json order (upstream vercel-labs#380), and a longer path prefix on a farther parent beat the root route of a closer one. With a plain checkout on acme.localhost and a worktree on feat-x.acme.localhost, tenant.feat-x.acme.localhost could be served by the plain checkout, and restarting a single app of the worktree mixed both stacks on one page. The closest parent now owns the request like an exact match does: path selection only looks at that hostname's routes, and a path it does not serve is a 404 instead of falling through to a farther parent. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LmsBY2Z3tFzHVrRHiVTfmZ
rqbazan
force-pushed
the
fix/wildcard-most-specific-host
branch
from
September 15, 2026 12:29
35f2eab to
c87709b
Compare
Merged
rqbazan
added a commit
that referenced
this pull request
Sep 15, 2026
Bump to 0.0.3 and add the changelog entry. The release ships the wildcard routing fix from #4: a subdomain goes to the closest registered parent hostname, and path selection no longer falls through to a farther parent. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LmsBY2Z3tFzHVrRHiVTfmZ
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
With
--wildcard,findRoutechose among every registered parent of the request hostname by path length only. That caused two defects:routes.jsonwon.--path): a longer prefix on a farther parent beat the root route of a closer parent, whatever the order.Example: a plain checkout on
acme.localhostand a worktree onfeat-x.acme.localhost. A request totenant.feat-x.acme.localhostcould be served by the plain checkout, and restarting a single app of the worktree mixed both stacks on one page.Change
The closest parent now owns the request, the same way an exact match does. The closest parent is the longest matching hostname, which is always a dot-bounded suffix of the request. Path selection only looks at that hostname's routes. If it has no route for the path, the proxy returns 404 instead of falling through to a farther parent.
Docs updated: README (subdomains and path-based routing sections),
skills/portless/SKILL.md,NOTICE,docs/SYNCING.md.Verification
proxy.test.ts, all failing before the fix:/settingspnpm format:check && pnpm lint && pnpm type-check && pnpm build && pnpm test && pnpm test:e2e: all green (982 unit, 16 e2e).:18080, its own state dir, no hosts sync. Aliases:acme-> main,acme --path /settings-> main-settings,feat-x.acme-> feat-x. Registered in both orders:tenant.feat-x.acme.localhost/tenant.feat-x.acme.localhost/settings/tenant.acme.localhost/tenant.acme.localhost/settings/No version bump here. The
0.0.3release follows in its own PR.🤖 Generated with Claude Code
https://claude.ai/code/session_01LmsBY2Z3tFzHVrRHiVTfmZ