From 90029fde9e3561f9a15a853c606f030cdd4e5e1a Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Wed, 1 May 2019 17:42:49 +0100 Subject: [PATCH] fix(client-src): don't use self.location.port ISSUE: https://github.com/webpack/webpack-dev-server/issues/1777 REF: https://github.com/webpack/webpack-dev-server/pull/1792 REF: https://github.com/webpack/webpack-dev-server/pull/1664 --- client-src/default/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client-src/default/index.js b/client-src/default/index.js index ef1ae918d7..a1d5443f22 100644 --- a/client-src/default/index.js +++ b/client-src/default/index.js @@ -198,7 +198,6 @@ 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 === '::') { @@ -208,7 +207,6 @@ 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; } } @@ -228,8 +226,8 @@ const socketUrl = url.format({ hostname, port: urlParts.path == null || urlParts.path === '/' - ? port - : querystring.parse(urlParts.path).sockPort || port, + ? urlParts.port + : querystring.parse(urlParts.path).sockPort || urlParts.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.