Skip to content

Commit a083b0b

Browse files
fix(server): Tailscale Serve forwards to the address a specific --host binds
loopbackUrlHostForAddress returned 127.0.0.1 for every listener except IPv6 loopback, so Tailscale Serve and the T3 Connect managed-tunnel origin pointed at a socket the server never opened when --host named one interface. Use the bound address unless the listener is a wildcard. Fixes #34733 AI-assisted; verified with the tests and tools listed above.
1 parent b1cf502 commit a083b0b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/server/src/startupAccess.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ export const acceptsPrivateNetworkConnection = (socket: {
7171
);
7272

7373
export const loopbackUrlHostForAddress = (address: NetAddress.InetAddress): string =>
74-
address._tag === "InetAddressV6" && NetAddress.isLoopback(address.address)
75-
? "[::1]"
76-
: "127.0.0.1";
74+
NetAddress.isUnspecified(address.address)
75+
? "127.0.0.1"
76+
: NetAddress.formatUrlHostString(NetAddress.formatIp(address.address));
7777

7878
const normalizeHost = (host: string): string =>
7979
host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;

0 commit comments

Comments
 (0)