Hosting and deploy
What is the localhost IP address?
localhost resolves to 127.0.0.1 in IPv4 and ::1 in IPv6, the loopback address of your own machine. What loopback means, 0.0.0.0, and why containers confuse it.
The localhost IP address is 127.0.0.1 in IPv4 and ::1 in IPv6. It is the loopback address: traffic sent there never leaves your computer and goes back to it. In fact the whole 127.0.0.0/8 range is reserved for loopback. Inside a container or virtual machine, localhost means that container itself, not your computer.
Published · Last updated
What loopback means
Every computer has a virtual network interface called loopback. Anything sent to the loopback address is delivered straight back to the same machine without touching a real network. Developers use it to run and test servers privately: a dev server on localhost is reachable only from that computer.
127.0.0.1, ::1 and localhost
- 127.0.0.1: the usual IPv4 loopback address. Any address from 127.0.0.0 to 127.255.255.255 also loops back.
- ::1: the IPv6 loopback address.
- localhost: a name that resolves to one or both. Some tools try ::1 first, so a server listening only on 127.0.0.1 can appear unreachable when you type localhost. Using 127.0.0.1 directly avoids that.
0.0.0.0 is different
When a server listens on 0.0.0.0, it accepts connections on all network interfaces, not only loopback. That is what you need for access from other devices on your network or from outside a container. As an address to connect to, 0.0.0.0 is not meaningful, and you should use a real IP instead.
# reachable only from this machine app.listen(3000, "127.0.0.1"); # reachable from other devices and from outside a container app.listen(3000, "0.0.0.0");
Containers and virtual machines
Inside a Docker container, localhost is the container. If your app in a container calls localhost:5432 expecting the database on your laptop, it finds nothing. With Docker Desktop, the special name host.docker.internal reaches the host. Between containers in Compose, use the service name, such as db:5432.
Testing loopback
To confirm something is listening on loopback, request it directly with curl http://127.0.0.1:3000. If that works and http://localhost:3000 does not, the server listens on IPv4 only and your tool tried IPv6 first. Telling the server to listen on both, or using the numeric address, resolves it.
Security
Binding a development database or admin tool to 127.0.0.1 keeps it off the network. Binding it to 0.0.0.0 on a laptop in a café or a cloud server makes it reachable by others. Choose deliberately.
Production code that calls localhost works only where the service runs on the same machine. In a browser, localhost is the visitor's own device.
What a scan can and cannot tell you
WebAuditOS scans public sites, so it never sees localhost. After deployment, it reports failed requests and console errors, which is where a frontend still calling a loopback address shows up.
Short answers
Is localhost always 127.0.0.1? Usually, and ::1 for IPv6.
Can someone else access my 127.0.0.1? No. It only loops back on your machine.
What is the difference between 127.0.0.1 and 0.0.0.0? 127.0.0.1 is loopback only. Listening on 0.0.0.0 means all interfaces.
Why does localhost work but 127.0.0.1 not, or the reverse? The server listens on only one of IPv4 or IPv6.
In the product
The checks this maps to
Every check named here runs on every scan, on every plan - what a plan changes is how many pages are crawled, how long the history is kept and what you can do with the result. These are the ids the findings carry, so you can match a line in a report to the explanation above.
- tech.failed-requests - No failed subresource requests
- tech.console-errors - No JavaScript errors in the console
Read next
Hosting and deploy
What is localhost:3000, and why won't it load?
localhost:3000 is a development server on your own computer. Which tools use port 3000, and how to fix refused connections and port in use errors.
Hosting and deploy
What is Docker, and why do developers use it?
Docker packages an app and everything it needs into a container that runs the same everywhere. Images, containers and Compose explained, plus security basics.