diff options
Diffstat (limited to 'ext/node/polyfills/http.ts')
-rw-r--r-- | ext/node/polyfills/http.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/node/polyfills/http.ts b/ext/node/polyfills/http.ts index 933a8dbcd..67981e8de 100644 --- a/ext/node/polyfills/http.ts +++ b/ext/node/polyfills/http.ts @@ -1653,7 +1653,10 @@ export class ServerImpl extends EventEmitter { // TODO(bnoordhuis) Node prefers [::] when host is omitted, // we on the other hand default to 0.0.0.0. - const hostname = options.host ?? "0.0.0.0"; + let hostname = options.host ?? "0.0.0.0"; + if (hostname == "localhost") { + hostname = "127.0.0.1"; + } this.#addr = { hostname, port, |