Skip to content

Commit 12c3f35

Browse files
rdlaboimhoffd
authored andcommitted
fix(serve): use 127.0.0.1 to attempt connections (#3476)
1 parent 4f17af3 commit 12c3f35

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/@ionic/cli-framework/src/utils/network.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ export function isPortAvailableForHost(host: string, port: number): Promise<bool
131131
export async function isHostConnectable(host: string, port: number, { timeout }: { timeout?: number; } = {}): Promise<boolean> {
132132
const tryConnect = async () => {
133133
return new Promise<boolean>((resolve, reject) => {
134+
if (host === '0.0.0.0') {
135+
host = '127.0.0.1';
136+
}
137+
134138
const sock = net.connect({ port, host });
135139

136140
sock.on('connect', () => {

0 commit comments

Comments
 (0)