Skip to content

Commit 88e1441

Browse files
authored
Do not override sockProtocol from config (#835)
* refactor: Do not override sockProtocol from config * style: Insert missing newline
1 parent 7adea92 commit 88e1441

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sockets/utils/getSocketUrlParts.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,12 @@ function getSocketUrlParts(resourceQuery, metadata) {
103103
// We only re-assign `protocol` when `protocol` is unavailable,
104104
// or if `hostname` is available and is empty,
105105
// since otherwise we risk creating an invalid URL.
106-
// We also do this when 'https' is used as it mandates the use of secure sockets.
106+
// We also do this when no sockProtocol was passed to the config and 'https' is used,
107+
// as it mandates the use of secure sockets.
107108
if (
108109
!urlParts.protocol ||
109-
(urlParts.hostname && (isEmptyHostname || window.location.protocol === 'https:'))
110+
(urlParts.hostname &&
111+
(isEmptyHostname || (!resourceQuery && window.location.protocol === 'https:')))
110112
) {
111113
urlParts.protocol = window.location.protocol;
112114
}

0 commit comments

Comments
 (0)