File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -867,10 +867,8 @@ export async function resolveServerUrls(
867
867
868
868
if ( hostname . host && loopbackHosts . has ( hostname . host ) ) {
869
869
let hostnameName = hostname . name
870
- if (
871
- hostnameName === '::1' ||
872
- hostnameName === '0000:0000:0000:0000:0000:0000:0000:0001'
873
- ) {
870
+ // ipv6 host
871
+ if ( hostnameName . includes ( ':' ) ) {
874
872
hostnameName = `[${ hostnameName } ]`
875
873
}
876
874
local . push ( `${ protocol } ://${ hostnameName } :${ port } ${ base } ` )
@@ -886,7 +884,11 @@ export async function resolveServerUrls(
886
884
( typeof detail . family === 'number' && detail . family === 4 ) ) ,
887
885
)
888
886
. forEach ( ( detail ) => {
889
- const host = detail . address . replace ( '127.0.0.1' , hostname . name )
887
+ let host = detail . address . replace ( '127.0.0.1' , hostname . name )
888
+ // ipv6 host
889
+ if ( host . includes ( ':' ) ) {
890
+ host = `[${ host } ]`
891
+ }
890
892
const url = `${ protocol } ://${ host } :${ port } ${ base } `
891
893
if ( detail . address . includes ( '127.0.0.1' ) ) {
892
894
local . push ( url )
You can’t perform that action at this time.
0 commit comments