mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
control/controlhttp: use custom port for non-localhost JS noise client connections
Control may not be bound to (just) localhost when sharing dev servers, allow the Wasm client to connect to it in that case too. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
parent
f981b1d9da
commit
e97d5634bf
@ -29,9 +29,11 @@ func (d *Dialer) Dial(ctx context.Context) (*controlbase.Conn, error) {
|
||||
|
||||
wsScheme := "wss"
|
||||
host := d.Hostname
|
||||
if host == "localhost" {
|
||||
// If using a custom control server (on a non-standard port), prefer that.
|
||||
// This mirrors the port selection in newNoiseClient from noise.go.
|
||||
if d.HTTPPort != "" && d.HTTPPort != "80" && d.HTTPSPort == "443" {
|
||||
wsScheme = "ws"
|
||||
host = net.JoinHostPort(host, strDef(d.HTTPPort, "80"))
|
||||
host = net.JoinHostPort(host, d.HTTPPort)
|
||||
}
|
||||
wsURL := &url.URL{
|
||||
Scheme: wsScheme,
|
||||
|
Loading…
x
Reference in New Issue
Block a user