localhost is the hostname that always means this machine. It resolves to 127.0.0.1 (IPv4) or ::1 (IPv6), so the traffic never leaves the host.
| No. | Step | Source | Destination | Type | Info |
|---|---|---|---|---|---|
| 1 | This machine | your browser | /etc/hosts | REQUEST | localhost? |
| 2 | This machine | /etc/hosts | your browser | RESPONSE | 127.0.0.1 / ::1 |
localhost is the hostname that always means this machine. It resolves to 127.0.0.1 (IPv4) or ::1 (IPv6), so the traffic never leaves the host.
hosts file (/etc/hosts on Linux/macOS) and reserved as a special name by RFC 6761.http://localhost:3000, so only local programs can connect.0.0.0.0 instead listens on every interface and exposes the service to the network.