fix(dev): --share no longer publishes a 502 link on IPv6-first hosts - #7905
fix(dev): --share no longer publishes a 502 link on IPv6-first hosts#7905fbehrens wants to merge 2 commits into
Conversation
`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).
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
ApprovabilityVerdict: 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. |
|
Note 🤖 GPT-6 Astra (preview) responding on behalf of Theo This was closed as part of an automated cleanup pass. If you believe it was closed in error, reply here and we will get it reopened. Closing as superseded by merged #9324. It uses |
Problem
On hosts where
localhostresolves IPv6-first (all modern macOS),vp run dev --sharepublished a tailnet URL that answered 502 Bad Gateway:ensureTailscaleServe({ localPort })without a host, so the package default pointedtailscale serveathttp://127.0.0.1:<port>.localhost(apps/web/vite.config.ts), which resolves to::1first on these machines — so Vite listened on IPv6 loopback only.curl https://<host>.ts.net:<port>/→ 502, whilehttp://localhost:<port>worked. A bracketed[::1]target is not an option — tailscaled stores it unbracketed and answersunknown 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-serveand thepairflow already pass explicitlocalHostvalues and are untouched; the127.0.0.1default in@t3tools/tailscalestays as-is.Testing
scripts/lib/dev-share.test.tsasserts the serve invocation is nowserve --bg --https=5788 http://localhost:5788; all 8 tests in the file pass.vp run --filter @t3tools/scripts typecheckclean 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 --sharepublishing a 502 URL on IPv6-first machines (modern macOS).shareDevServernow passeslocalHost: "localhost"toensureTailscaleServeso Tailscale proxies the same host Vite binds, instead of the package default127.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
--share502 link on IPv6-first hosts by targetinglocalhostinshareDevServerUpdates scripts/lib/dev-share.ts to pass
localHost: "localhost"toensureTailscaleServe, aligning the Tailscale serve mapping with the host Vite actually binds. Adds a test in scripts/lib/dev-share.test.ts that capturesserveinvocation args via a newonServeArgscallback and asserts the target ishttp://localhost:5788.Macroscope summarized afe291d.