Skip to content

fix(dev): --share no longer publishes a 502 link on IPv6-first hosts - #7905

Open
fbehrens wants to merge 2 commits into
pingdotgg:mainfrom
fbehrens:fix/share-ipv6-loopback
Open

fix(dev): --share no longer publishes a 502 link on IPv6-first hosts#7905
fbehrens wants to merge 2 commits into
pingdotgg:mainfrom
fbehrens:fix/share-ipv6-loopback

Conversation

@fbehrens

@fbehrens fbehrens commented Aug 22, 2026

Copy link
Copy Markdown

Problem

On hosts where localhost resolves IPv6-first (all modern macOS), vp run dev --share published a tailnet URL that answered 502 Bad Gateway:

  • The dev runner's share path called ensureTailscaleServe({ localPort }) without a host, so the package default pointed tailscale serve at http://127.0.0.1:<port>.
  • But the Vite dev server binds localhost (apps/web/vite.config.ts), which resolves to ::1 first on these machines — so Vite listened on IPv6 loopback only.
  • Result: curl https://<host>.ts.net:<port>/ → 502, while http://localhost:<port> worked. A bracketed [::1] target is not an option — tailscaled stores it unbracketed and answers unknown proxy destination.

Fix

Pass localHost: "localhost" in the dev-share mapping so tailscaled resolves the proxy target exactly like the dev server did — the mapping and the listener agree by construction, whatever loopback family the OS prefers.

The server's own --tailscale-serve and the pair flow already pass explicit localHost values and are untouched; the 127.0.0.1 default in @t3tools/tailscale stays as-is.

Testing

  • Focused test in scripts/lib/dev-share.test.ts asserts the serve invocation is now serve --bg --https=5788 http://localhost:5788; all 8 tests in the file pass.
  • vp run --filter @t3tools/scripts typecheck clean for touched scope (one pre-existing unrelated suggestion), lint clean.

Worked on by ox-alpha (opencode harness).


Note

Low Risk
Dev-only Tailscale share mapping change with a focused unit test; no production auth or data-path impact.

Overview
Fixes vp run dev --share publishing a 502 URL on IPv6-first machines (modern macOS). shareDevServer now passes localHost: "localhost" to ensureTailscaleServe so Tailscale proxies the same host Vite binds, instead of the package default 127.0.0.1.

Adds a test that captures serve args and asserts the target is http://localhost:<port>.

Reviewed by Cursor Bugbot for commit afe291d. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix --share 502 link on IPv6-first hosts by targeting localhost in shareDevServer

Updates scripts/lib/dev-share.ts to pass localHost: "localhost" to ensureTailscaleServe, aligning the Tailscale serve mapping with the host Vite actually binds. Adds a test in scripts/lib/dev-share.test.ts that captures serve invocation args via a new onServeArgs callback and asserts the target is http://localhost:5788.

Macroscope summarized afe291d.

`vp run dev --share` pointed `tailscale serve` at 127.0.0.1, but the Vite
dev server binds `localhost`, which resolves to ::1 first on modern macOS.
The tailnet URL therefore answered 502 while localhost worked.

Pass localHost: "localhost" for the dev share mapping so tailscaled
resolves the proxy target exactly like the dev server did; the mapping
and the listener agree by construction. The server's own --tailscale-serve
and pair flows already pass explicit hosts and are untouched.

Worked on by ox-alpha (opencode).
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bde738b7-3134-471e-bf2a-55ff80fb23ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 22, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Skipped

Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically.

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

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant