Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check 0.0.0.0 on server start
Browse files Browse the repository at this point in the history
scttpr committed Oct 27, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 192eacf commit 77bc580
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/vite/src/node/http.ts
Original file line number Diff line number Diff line change
@@ -178,8 +178,19 @@ export async function httpServerStart(
httpServer.on('error', onError)

httpServer.listen(port, host, () => {
httpServer.removeListener('error', onError)
resolve(port)
if (host === 'localhost') {
httpServer.close()
httpServer.listen(port, '0.0.0.0', () => {
httpServer.close()
httpServer.listen(port, host, () => {
httpServer.removeListener('error', onError)
resolve(port)
})
})
} else {
httpServer.removeListener('error', onError)
resolve(port)
}
})
})
}

0 comments on commit 77bc580

Please sign in to comment.