cloudflare / miniflare

🔥 Fully-local simulator for Cloudflare Workers. For the latest version, see https://github.com/cloudflare/workers-sdk/tree/main/packages/miniflare.
https://miniflare.dev
MIT License
3.78k stars 205 forks source link

[Miniflare 3] Use `localhost` instead of `127.0.0.1` for loopback hostname #615

Closed mrbbot closed 1 year ago

mrbbot commented 1 year ago

Miniflare starts its loopback server on the same host as the workerd server, so it's accessible on all the same addresses as the runtime. This allows the loopback server to be the target for the live reload web socket. This means if the host: "localhost" option is set, we start a Node http server with localhost as the hostname. Node will perform a DNS lookup to work out which IP address and interface to listen on, but will only listen on the first entry. In Node 17+, this will be the IPv6 interface. Unfortunately, we previously hardcoded the loopback address as the IPv4 loopback, meaning workerd was unable to connect. This change switches to using localhost, which workerd will resolve to either IPv4 or v6.

Closes cloudflare/workers-sdk#3515

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: dbfe5d929b6ea363e3231651d0ec877d9442ac9f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR