File tree Expand file tree Collapse file tree
examples/modus-manual-script Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ var onSocketMsg = {
8989} ;
9090
9191var hostname = urlParts . hostname ;
92+ var protocol = urlParts . protocol ;
9293
9394if ( urlParts . hostname === '0.0.0.0' ) {
9495 // why do we need this check?
@@ -99,8 +100,16 @@ if(urlParts.hostname === '0.0.0.0') {
99100 }
100101}
101102
103+ // `hostname` can be empty when the script path is relative. In that case, specifying
104+ // a protocol would result in an invalid URL.
105+ // When https is used in the app, secure websockets are always necessary
106+ // because the browser doesn't accept non-secure websockets.
107+ if ( hostname && ( window . location . protocol === "https:" || urlParts . hostname === '0.0.0.0' ) ) {
108+ protocol = window . location . protocol ;
109+ }
110+
102111var socketUrl = url . format ( {
103- protocol : ( window . location . protocol === "https:" || urlParts . hostname === '0.0.0.0' ) ? window . location . protocol : urlParts . protocol ,
112+ protocol : protocol ,
104113 auth : urlParts . auth ,
105114 hostname : hostname ,
106115 port : ( urlParts . port === '0' ) ? window . location . port : urlParts . port ,
Original file line number Diff line number Diff line change 11# Modus: manual script
22
33``` shell
4- node ../../bin/webpack-dev-server.js --open
4+ node ../../bin/webpack-dev-server.js --open --no-inline
55```
66
77The webpack-dev-server client is added as script tag to the html page.
88
99``` shell
10- node ../../bin/webpack-dev-server.js --open --https
10+ node ../../bin/webpack-dev-server.js --open --no-inline -- https
1111```
1212
1313This will do the same, but connect over https.
You can’t perform that action at this time.
0 commit comments