File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -193,10 +193,25 @@ function resolveLoopback(proxy) {
193
193
if ( o . hostname !== 'localhost' ) {
194
194
return proxy ;
195
195
}
196
- try {
196
+ // Unfortunately, many languages (unlike node) do not yet support IPv6
197
+ // this means even though localhost resolves to ::1, the application
198
+ // must fall back to IPv4 (on 127.0.0.1).
199
+ // We can re-enable this in a few years.
200
+ /*try {
197
201
o.hostname = address.ipv6() ? '::1' : '127.0.0.1';
198
202
} catch (_ignored) {
199
203
o.hostname = '127.0.0.1';
204
+ }*/
205
+
206
+ try {
207
+ // Check if we're on a network; if we are, chances are we can resolve
208
+ // localhost. Otherwise, we can just be safe and assume localhost is
209
+ // IPv4 for maximum compatibility.
210
+ if ( ! address . ip ( ) ) {
211
+ o . hostname = '127.0.0.1' ;
212
+ }
213
+ } catch ( _ignored ) {
214
+ o . hostname = '127.0.0.1' ;
200
215
}
201
216
return url . format ( o ) ;
202
217
}
You can’t perform that action at this time.
0 commit comments