Networking

How to Diagnose ERR_CONNECTION_REFUSED

ERR_CONNECTION_REFUSED means the host answered but nothing accepted the connection on that port. Reproduced: closed port, wrong interface, IPv6 localhost.

ERR_CONNECTION_REFUSED means your browser reached the machine, but no program accepted the connection on that port, so the machine answered with a TCP reset. Chromium defines it simply as “A connection attempt was refused.” The usual causes are a server that is not running, the wrong port, a server listening on a different address, or a firewall set to reject.

DiagnoseAnswer a few questions to narrow down the cause

Which site gives the error?

  • My own local server (localhost, 127.0.0.1) →

    Is the server process actually running and listening?

    Check with: lsof -nP -iTCP -sTCP:LISTEN (macOS/Linux) or netstat -ano | findstr LISTENING (Windows).

    • Not listed →

      Start the server.

      Nothing is listening, so the operating system refuses every attempt. Start it and watch its log for a “listening on” line; if it exits immediately, the log usually says why (port in use, bad config).

    • Listed, on a different port →

      Use the port the server reports.

      Dev servers often pick another port when the default is busy. Use the exact host:port the server prints.

    • Listed on the right port →

      Which address is it listening on?

      • 127.0.0.1 only, and I use http://localhost →

        localhost resolved to ::1, but the server only listens on 127.0.0.1.

        Try http://127.0.0.1:PORT directly. To fix it permanently, make the server listen on both, or on ::1 as well.

        curl -sS http://127.0.0.1:8081/   # works
        curl -sS http://[::1]:8081/      # refused
      • 127.0.0.1, and I connect from another device →

        Bind the server to the LAN interface.

        127.0.0.1 is reachable only from the same machine. Listen on 0.0.0.0 (all IPv4 interfaces) or the machine's LAN address, and allow it in the firewall.

      • 0.0.0.0 or * →

        Check the host firewall.

        A firewall rule that rejects (rather than silently drops) connections produces exactly this error. Allow the port for the server process, then retry.

  • A website or service on the internet →

    Do other people or networks get the same error?

    Try mobile data, or ask someone else to load it.

    • Yes, everyone →

      The service is down or the port is closed on the server.

      Nothing you change locally will fix it. If it is your server, check that the web server is running and listening on 80/443, and that the cloud firewall/security group allows the port.

    • Only me / only this network →

      Check proxy, VPN and security software on your side.

      A misconfigured proxy (often left behind by removed software) or a VPN can refuse on your behalf. In Chrome, open Settings → System → proxy settings; disable the VPN and retry. Also clear the site's HSTS/DNS cache only after ruling these out.

  • A device on my network (router, NAS, camera) →

    Does the device answer ping?

    • Yes →

      The device is up but not serving on that port.

      Check the device's admin port (some use 8080 or 8443) and whether its web interface is enabled, then use http://IP:PORT.

    • No →

      This is closer to a reachability problem.

      A device that never answers usually produces a timeout or ERR_ADDRESS_UNREACHABLE rather than a refusal. Check its IP address and that it is on your subnet.

What “refused” means at the TCP level

When a TCP connection request (a SYN) arrives at a port with no listening program, the receiving operating system replies with a RST (reset) instead of completing the handshake. The browser receives that reset within milliseconds and reports the refusal. This is different from a timeout (no answer at all, often a firewall that silently drops) and from a reset after connecting, covered in the ERR_CONNECTION_RESET guide.

Reproducing it

We triggered refusals on a Mac and recorded the exact messages. First, a request to a port where nothing listens:

$ curl -sS http://127.0.0.1:9/
curl: (7) Failed to connect to 127.0.0.1 port 9 after 0 ms: Couldn't connect to server

“After 0 ms” is the signature of a refusal: the answer came back immediately.

Second, a Node.js server listening only on 127.0.0.1, reached first over IPv4 and then over the IPv6 loopback address ::1:

$ curl -sS http://127.0.0.1:8081/
ok
$ curl -sS "http://[::1]:8081/"
curl: (7) Failed to connect to ::1 port 8081 after 0 ms: Couldn't connect to server

Both addresses mean “this machine”, but they are different sockets. If localhost resolves to ::1 first, a browser hits the refused one. Development servers that bind to 127.0.0.1 are a common source of this; the IPv4 vs. IPv6 guide lists the equivalent addresses.

Third, nc gives a quick yes or no for any port:

$ nc -vz 127.0.0.1 8081
Connection to 127.0.0.1 port 8081 [tcp/sunproxyadmin] succeeded!
$ nc -vz 127.0.0.1 8082
nc: connectx to 127.0.0.1 port 8082 (tcp) failed: Connection refused

(The sunproxyadmin label is just nc’s name for port 8081 from the services list; it does not mean that software is involved.)

Fix checklist

  1. Confirm the address and port in the URL, including http vs https (port 80 vs 443).
  2. Is anything listening? lsof -nP -iTCP -sTCP:LISTEN on macOS and Linux, netstat -ano | findstr LISTENING on Windows.
  3. Listening on the right interface? 127.0.0.1 is local-only; 0.0.0.0 accepts from the network; ::1 is IPv6 loopback.
  4. Firewall: a rule set to reject produces a refusal; one set to drop produces a timeout.
  5. For public sites: test from another network. If it fails everywhere, the server side is at fault.
  6. Proxy or VPN: disable them to see if the error changes.

To see how a connection is set up in the first place, the TCP vs. UDP test logs a handshake and a refused UDP send.

Sources

  1. net_error_list.h (CONNECTION_REFUSED = −102) — Chromium
  2. RFC 9293: Transmission Control Protocol — IETF. a SYN to a closed port is answered with RST
  3. Fix connection errors — Google Chrome Help

How we made this

Reproduced in a local lab. We reproduced three refusals on a Mac with curl 8.7.1 and nc: a request to a port with no listener, a Node.js HTTP server bound only to 127.0.0.1 and reached via ::1, and nc probes of an open and a closed port. Outputs are quoted verbatim. Chrome's meaning of the error is taken from Chromium's net_error_list.h.

Performed by Claude, an AI assistant working in the BinConvert repository (macOS on Apple Silicon, curl 8.7.1, Node.js 25.8.2), November 16, 2026.

This article was drafted with AI assistance. Every example, calculation and command output on this page was re-run or checked before release; the three refusals were reproduced again with identical messages. Review: automated test suite and source check, November 16, 2026.

Spotted an error? Tell us and we will correct it.

Copied to clipboard!