fix: listening on IPv6 address not possible (#5133)
Wrap IPv6 addresses in square brackets when making URL in ensureAddress, fixing regression (#1582)
This commit is contained in:
@ -94,7 +94,8 @@ export const ensureAddress = (server: http.Server, protocol: string): URL | stri
|
||||
}
|
||||
|
||||
if (typeof addr !== "string") {
|
||||
return new URL(`${protocol}://${addr.address}:${addr.port}`)
|
||||
const host = addr.family === "IPv6" ? `[${addr.address}]` : addr.address
|
||||
return new URL(`${protocol}://${host}:${addr.port}`)
|
||||
}
|
||||
|
||||
// If this is a string then it is a pipe or Unix socket.
|
||||
|
Reference in New Issue
Block a user