diff --git a/cmd/tailscale/cli/serve.go b/cmd/tailscale/cli/serve.go index 572e2148b..3ad0bb432 100644 --- a/cmd/tailscale/cli/serve.go +++ b/cmd/tailscale/cli/serve.go @@ -699,7 +699,7 @@ func (e *serveEnv) printWebStatusTree(sc *ipn.ServeConfig, hp ipn.HostPort) erro portPart = "" } if scheme == "http" { - hostname, _, _ := strings.Cut("host", ".") + hostname, _, _ := strings.Cut(host, ".") printf("%s://%s%s (%s)\n", scheme, hostname, portPart, fStatus) } printf("%s://%s%s (%s)\n", scheme, host, portPart, fStatus) diff --git a/ipn/ipnlocal/serve.go b/ipn/ipnlocal/serve.go index a6a7d1421..aa2c1a605 100644 --- a/ipn/ipnlocal/serve.go +++ b/ipn/ipnlocal/serve.go @@ -415,6 +415,9 @@ func (b *LocalBackend) getServeHandler(r *http.Request) (_ ipn.HTTPHandlerView, hostname := r.Host if r.TLS == nil { tcd := "." + b.Status().CurrentTailnet.MagicDNSSuffix + if host, _, err := net.SplitHostPort(hostname); err == nil { + hostname = host + } if !strings.HasSuffix(hostname, tcd) { hostname += tcd }