Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client-src/default/utils/createSocketUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function createSocketUrl(resourceQuery) {
// because the browser doesn't accept non-secure websockets.
if (
hostname &&
hostname !== '127.0.0.1' &&
(self.location.protocol === 'https:' || urlParts.hostname === '0.0.0.0')
) {
protocol = self.location.protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ exports[`createSocketUrl should return the url when __resourceQuery is ?test 1`]

exports[`createSocketUrl should return the url when __resourceQuery is http://0.0.0.0 1`] = `"http://localhost/sockjs-node"`;

exports[`createSocketUrl should return the url when __resourceQuery is http://127.0.0.1 1`] = `"http://127.0.0.1/sockjs-node"`;

exports[`createSocketUrl should return the url when __resourceQuery is http://user:pass@[::]:8080 1`] = `"http://user:pass@localhost:8080/sockjs-node"`;

exports[`createSocketUrl should return the url when __resourceQuery is http://user:password@localhost/ 1`] = `"http://user:password@localhost/sockjs-node"`;
Expand All @@ -22,6 +24,8 @@ exports[`createSocketUrl should return the url when the current script source is

exports[`createSocketUrl should return the url when the current script source is http://0.0.0.0 1`] = `"http://localhost/sockjs-node"`;

exports[`createSocketUrl should return the url when the current script source is http://127.0.0.1 1`] = `"http://127.0.0.1/sockjs-node"`;

exports[`createSocketUrl should return the url when the current script source is http://user:pass@[::]:8080 1`] = `"http://user:pass@localhost:8080/sockjs-node"`;

exports[`createSocketUrl should return the url when the current script source is http://user:password@localhost/ 1`] = `"http://user:password@localhost/sockjs-node"`;
Expand Down
1 change: 1 addition & 0 deletions test/client/utils/createSocketUrl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ describe('createSocketUrl', () => {
'http://0.0.0.0',
'https://localhost:123',
'http://user:pass@[::]:8080',
'http://127.0.0.1',
// TODO: comment out after the major release
// https://github.com/webpack/webpack-dev-server/pull/1954#issuecomment-498043376
// 'file://filename',
Expand Down