Repository navigation
Description
Problem
t3 pair can generate a terminal QR code using the discovered server address or configure Tailscale Serve with --tailscale, but it does not accept an explicit public URL.
My use case is running T3 inside a DevPod container while Tailscale Serve runs on the host. The host exposes a stable HTTPS tailnet URL and proxies to a forwarded container port. The container hostname/IP can change, and Tailscale is intentionally not installed inside the container.
Plain t3 pair advertises the local/container address, while t3 pair --tailscale assumes it can manage Tailscale on the machine where the command runs.
Requested behavior
Allow an explicit public base URL when generating the pairing link and terminal QR code:
t3 pair \
--base-dir /path/to/t3-data \
--base-url https://my-host.my-tailnet.ts.netThe command should still discover the running local server and mint its pairing token, but use the supplied URL for the advertised connection address, pairing link, and QR code. It should not configure Tailscale or change the server bind address; proxy setup remains the responsibility of the user.
This would also support other reverse proxies and SSH-forwarded deployments.
Existing workaround
t3 auth pairing create --base-url https://my-host.my-tailnet.ts.net already supports an explicit public URL, but does not offer the same terminal QR output as t3 pair. Users must render the resulting link separately, for example with qrencode.
Related issues
- Advertise Tailscale Serve HTTPS URL in headless pairing output #2834 requested advertising the Tailscale HTTPS URL and an explicit host override; it is closed, but the current
t3 paircommand still lacks a public URL override. - [Bug]: Misleading server link for --host 0.0.0.0 address #8384 reports pairing output advertising a Docker container IP that is not reachable from the client.
This request is specifically to expose an explicit --base-url override in t3 pair, consistent with t3 auth pairing create.
Activity
juliusmarminge commentedon Sep 25, 2026
Triage: #13582
Verdict: Accept
Type: Feature request
Duplicate: No
Already implemented: No
Confidence: High
Suggested labels:
enhancement,acceptedScope: Small. One CLI flag on
t3 pair, tests, and a short docs note. No server, auth, or protocol change.What was asked
t3 paircan print a QR for the discovered local address, or it can runtailscale serveand print the MagicDNS HTTPS URL. It cannot take an explicit public URL.The reporter runs T3 inside a DevPod container. Tailscale Serve runs on the host and proxies a stable
https://…ts.netURL to a forwarded container port. The container address changes, and Tailscale is intentionally not installed in the container, sot3 pair --tailscaleis the wrong tool. They want:Discovery and token minting stay against the running local server. The supplied URL is used only for the pairing link and QR. The command must not configure Tailscale or change the bind address.
What the code does today
t3 pair(apps/server/src/cli/pair.ts) only has--base-dir,--ttl,--label,--tailscale, and--tailscale-serve-port. There is no--base-url.Discovery is already separate from the advertised URL.
discoverPairTargetreadsserver-runtime.json, checks the pid, and probesstate.origin. The advertised URL is chosen afterward:--tailscalecallsresolveTailscalePairingBase, which reads MagicDNS and may runtailscale serve.resolveDirectPairingBaseUrlusesstate.devUrlorresolveHeadlessConnectionString(state.host, state.port).--tailscaleor restart with a reachable--host.The QR and
Pairing URL:line both come frombuildPairingUrlinapps/server/src/startupAccess.ts. The header still prints the discovered local origin (Pairing with <label> (<origin>)).t3 auth pairing create --base-urlis a real workaround and a real gap.apps/server/src/cli/auth.tspasses the flag intoformatIssuedPairingCredential, which printsPair URL:. That formatter does not render a QR (renderTerminalQrCodeis only used byt3 pairand headlesst3 serve). It also does not discover a live server or confirm the process is answering. It only writes a token into the CLI auth database. So the workaround matches the URL override and misses the reasont3 pairexists.No
--tailscale-serve-hostor other public-URL override exists in the tree. The onlybase-urlflag underapps/server/src/cliis the one ont3 auth pairing create.Not a duplicate
t3 pair --tailscale, which manages Tailscale on the machine where the command runs. The proposed--tailscale-serve-hostfrom Advertise Tailscale Serve HTTPS startup URLs #2835 was never merged. [Feature]: Support --base-url in t3 pair for externally proxied servers #13582 is the leftover case: advertise a URL this command does not own.t3 servestartup output. With--host 0.0.0.0,resolveHeadlessConnectionHostsubstitutes the first external interface address, which inside Docker is the container IP. At3 pair --base-urlflag would not change that banner. It can be a later workaround fort3 paironly.No other open issue or PR adds
--base-urltot3 pair.Implementation notes
Keep discovery as it is. After
discoverPairTargetsucceeds, if--base-urlis set, use that string aspairingBaseUrland skipresolveTailscalePairingBaseentirely.--base-urlwith--tailscale. One advertises a user-owned proxy; the other mutates Tailscale Serve.http:orhttps:URL. Do not let a bad value throw an uncaughtTypeErrorfromnew URL.t3 auth pairing create --base-url.Pairing URL:line.buildPairingUrl. It setspathnameto/pair, so a base URL with a path prefix loses that prefix. The requested URL has no path.formatIssuedPairingCredentialdoes the same vianew URL("/pair", baseUrl). Treat the flag as an origin, not a subpath mount./pairis on the web origin, not the API port. Help text should say the URL must reach the same origin the client will open.Tests belong next to the existing pair URL tests in
apps/server/src/cli/pair.test.ts: the QR and pairing URL use the override, the loopback note is absent for a public host, an invalid URL fails, and--tailscaleis not invoked. Document the flag indocs/user/remote-access.mdbeside the existingt3 pair/t3 pair --tailscaleexamples.Risks
The QR will contain a one-time token aimed at whatever host the user typed. That is the same exposure as the existing auth command. A wrong URL sends the token to the wrong host. Do not try to fix that by probing.
This does not fix #8384.
t3 servewill still print a container address when bound to0.0.0.0.tpetr commentedon Oct 1, 2026
Thanks for raising this! I ran into the same problem with T3 in a Coder workspace: T3 listens on localhost, while Coder exposes it at a public URL through its reverse proxy. The proposed
t3 pair --base-urloption would solve one-off pairing.One additional behavior I’d find useful is a server-level public URL setting, so startup pairing output and plain
t3 pairuse that URL by default. The CLI option could still override it for an individual link. Local discovery and the bind address would stay unchanged.I started a prototype of the server-level setting before finding this issue and the PR. I’m not asking to expand or delay the current PR, but would a separate follow-up be welcome? I’d be happy to adapt my work if useful.
SpyrosPsarras commentedon Oct 7, 2026
Another case for the server-level setting tpetr describes: T3 running headless in a Kubernetes pod behind an ingress. The server binds
0.0.0.0in the pod, so the startup pairing link andt3 pair(run throughkubectl exec) both advertise the pod IP. That IP changes on every restart and clients can't reach it.--base-urlcovers one-off links, but the deployment already knows its public URL, so settingT3CODE_PUBLIC_URLonce in the pod spec would fix every link the server prints. #7569 asks for the same thing.@juliusmarminge, would a follow-up PR for
--public-url/T3CODE_PUBLIC_URLonserve/startbe in scope?