File tree 1 file changed +12
-1
lines changed 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -88,10 +88,21 @@ var onSocketMsg = {
88
88
}
89
89
} ;
90
90
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
+
91
102
var socketUrl = url . format ( {
92
103
protocol : ( window . location . protocol === "https:" || urlParts . hostname === '0.0.0.0' ) ? window . location . protocol : urlParts . protocol ,
93
104
auth : urlParts . auth ,
94
- hostname : ( urlParts . hostname === '0.0.0.0' ) ? window . location . hostname : urlParts . hostname ,
105
+ hostname : hostname ,
95
106
port : ( urlParts . port === '0' ) ? window . location . port : urlParts . port ,
96
107
pathname : urlParts . path == null || urlParts . path === '/' ? "/sockjs-node" : urlParts . path
97
108
} ) ;
You can’t perform that action at this time.
0 commit comments