File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,10 +88,21 @@ var onSocketMsg = {
8888 }
8989} ;
9090
91+ var hostname = urlParts . hostname ;
92+
93+ if ( urlParts . hostname === '0.0.0.0' ) {
94+ // why do we need this check?
95+ // hostname n/a for file protocol (example, when using electron, ionic)
96+ // see: https://github.com/webpack/webpack-dev-server/pull/384
97+ if ( window . location . hostname && ! ! ~ window . location . protocol . indexOf ( 'http' ) ) {
98+ hostname = window . location . hostname ;
99+ }
100+ }
101+
91102var socketUrl = url . format ( {
92103 protocol : ( window . location . protocol === "https:" || urlParts . hostname === '0.0.0.0' ) ? window . location . protocol : urlParts . protocol ,
93104 auth : urlParts . auth ,
94- hostname : ( urlParts . hostname === '0.0.0.0' ) ? window . location . hostname : urlParts . hostname ,
105+ hostname : hostname ,
95106 port : ( urlParts . port === '0' ) ? window . location . port : urlParts . port ,
96107 pathname : urlParts . path == null || urlParts . path === '/' ? "/sockjs-node" : urlParts . path
97108} ) ;
You can’t perform that action at this time.
0 commit comments