You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Support --base-url in t3 pair for externally proxied servers #13582
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.net
The 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.
Verdict: Accept Type: Feature request Duplicate: No Already implemented: No Confidence: High Suggested labels:enhancement, accepted Scope: Small. One CLI flag on t3 pair, tests, and a short docs note. No server, auth, or protocol change.
What was asked
t3 pair can print a QR for the discovered local address, or it can run tailscale serve and 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.net URL to a forwarded container port. The container address changes, and Tailscale is intentionally not installed in the container, so t3 pair --tailscale is the wrong tool. They want:
t3 pair \
--base-dir /path/to/t3-data \
--base-url https://my-host.my-tailnet.ts.net
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. discoverPairTarget reads server-runtime.json, checks the pid, and probes state.origin. The advertised URL is chosen afterward:
--tailscale calls resolveTailscalePairingBase, which reads MagicDNS and may run tailscale serve.
Otherwise resolveDirectPairingBaseUrl uses state.devUrl or resolveHeadlessConnectionString(state.host, state.port).
A loopback result adds the note to re-run with --tailscale or restart with a reachable --host.
The QR and Pairing URL: line both come from buildPairingUrl in apps/server/src/startupAccess.ts. The header still prints the discovered local origin (Pairing with <label> (<origin>)).
t3 auth pairing create --base-url is a real workaround and a real gap. apps/server/src/cli/auth.ts passes the flag into formatIssuedPairingCredential, which prints Pair URL:. That formatter does not render a QR (renderTerminalQrCode is only used by t3 pair and headless t3 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 reason t3 pair exists.
No --tailscale-serve-host or other public-URL override exists in the tree. The only base-url flag under apps/server/src/cli is the one on t3 auth pairing create.
[Bug]: Misleading server link for --host 0.0.0.0 address #8384 (open bug) is t3 serve startup output. With --host 0.0.0.0, resolveHeadlessConnectionHost substitutes the first external interface address, which inside Docker is the container IP. A t3 pair --base-url flag would not change that banner. It can be a later workaround for t3 pair only.
No other open issue or PR adds --base-url to t3 pair.
Implementation notes
Keep discovery as it is. After discoverPairTarget succeeds, if --base-url is set, use that string as pairingBaseUrl and skip resolveTailscalePairingBase entirely.
Reject combining --base-url with --tailscale. One advertises a user-owned proxy; the other mutates Tailscale Serve.
Require an absolute http: or https: URL. Do not let a bad value throw an uncaught TypeError from new URL.
Do not probe the public URL before printing. In the DevPod case the container often cannot hairpin to the host proxy, and a required probe would fail the exact setup this flag is for. Reachability stays the user's responsibility, same as t3 auth pairing create --base-url.
Skip the loopback note when the supplied host is not loopback. Keep it if they explicitly pass a loopback URL.
Leave the header origin as the discovered local server so it is obvious which process received the token. Put the public URL only in the QR and Pairing URL: line.
Reuse buildPairingUrl. It sets pathname to /pair, so a base URL with a path prefix loses that prefix. The requested URL has no path. formatIssuedPairingCredential does the same via new URL("/pair", baseUrl). Treat the flag as an origin, not a subpath mount.
For a dev server, /pair is 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 --tailscale is not invoked. Document the flag in docs/user/remote-access.md beside the existing t3 pair / t3 pair --tailscale examples.
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 serve will still print a container address when bound to 0.0.0.0.
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-url option 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 pair use 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.
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.0 in the pod, so the startup pairing link and t3 pair (run through kubectl exec) both advertise the pod IP. That IP changes on every restart and clients can't reach it. --base-url covers one-off links, but the deployment already knows its public URL, so setting T3CODE_PUBLIC_URL once 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_URL on serve/start be in scope?
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?