From 5ecf099e2df8097b8cb055f9b5dd225297ba4489 Mon Sep 17 00:00:00 2001 From: Ramon Lamana Date: Wed, 13 Feb 2019 12:22:49 -0800 Subject: [PATCH] Use location.port when location.hostname is used as a fallback in client --- client-src/default/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client-src/default/index.js b/client-src/default/index.js index cfee77ba62..6340a9d1f6 100644 --- a/client-src/default/index.js +++ b/client-src/default/index.js @@ -181,6 +181,7 @@ const onSocketMsg = { let hostname = urlParts.hostname; let protocol = urlParts.protocol; +let port = urlParts.port; // check ipv4 and ipv6 `all hostname` if (hostname === '0.0.0.0' || hostname === '::') { @@ -190,6 +191,7 @@ if (hostname === '0.0.0.0' || hostname === '::') { // eslint-disable-next-line no-bitwise if (self.location.hostname && !!~self.location.protocol.indexOf('http')) { hostname = self.location.hostname; + port = self.location.port; } } @@ -208,7 +210,7 @@ const socketUrl = url.format({ protocol, auth: urlParts.auth, hostname, - port: urlParts.port, + port, // If sockPath is provided it'll be passed in via the __resourceQuery as a // query param so it has to be parsed out of the querystring in order for the // client to open the socket to the correct location.