Skip to content

Commit 5ecf099

Browse files
committed
Use location.port when location.hostname is used as a fallback in client
1 parent cb10f83 commit 5ecf099

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client-src/default/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ const onSocketMsg = {
181181

182182
let hostname = urlParts.hostname;
183183
let protocol = urlParts.protocol;
184+
let port = urlParts.port;
184185

185186
// check ipv4 and ipv6 `all hostname`
186187
if (hostname === '0.0.0.0' || hostname === '::') {
@@ -190,6 +191,7 @@ if (hostname === '0.0.0.0' || hostname === '::') {
190191
// eslint-disable-next-line no-bitwise
191192
if (self.location.hostname && !!~self.location.protocol.indexOf('http')) {
192193
hostname = self.location.hostname;
194+
port = self.location.port;
193195
}
194196
}
195197

@@ -208,7 +210,7 @@ const socketUrl = url.format({
208210
protocol,
209211
auth: urlParts.auth,
210212
hostname,
211-
port: urlParts.port,
213+
port,
212214
// If sockPath is provided it'll be passed in via the __resourceQuery as a
213215
// query param so it has to be parsed out of the querystring in order for the
214216
// client to open the socket to the correct location.

0 commit comments

Comments
 (0)