Skip to content

Use 127.0.0.1 as default hostname #2057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/selfish-falcons-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"hardhat": patch
---

Fix an issue with new versions of Node.js that prevented clients from connecting to Hardhat's node using 127.0.0.1
4 changes: 2 additions & 2 deletions packages/hardhat-core/src/builtin-tasks/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ task(TASK_NODE, "Starts a JSON-RPC server on top of Hardhat Network")
forkUrl,
});

// the default hostname is "localhost" unless we are inside a docker
// the default hostname is "127.0.0.1" unless we are inside a docker
// container, in that case we use "0.0.0.0"
let hostname: string;
if (hostnameParam !== undefined) {
Expand All @@ -310,7 +310,7 @@ task(TASK_NODE, "Starts a JSON-RPC server on top of Hardhat Network")
if (insideDocker) {
hostname = "0.0.0.0";
} else {
hostname = "localhost";
hostname = "127.0.0.1";
}
}

Expand Down