Skip to content

Test your website now

Free, no card. We read only public pages.

Run free audit →

HTTP errors

What does ERR_CONNECTION_REFUSED mean, and how do you fix it?

ERR_CONNECTION_REFUSED means nothing accepted the connection on that port. Causes on localhost, in containers and in production, and how to check each.

ERR_CONNECTION_REFUSED means your browser reached the machine but nothing was listening on that port, or a firewall rejected the connection. On localhost it almost always means the dev server is not running or uses a different port. In production it means the web server is down, listening elsewhere, or blocked by a firewall.

Published · Last updated

By Michal Měřínský. Audit methodology.

What it means

Before any HTTP status can exist, the browser has to open a connection to an address and port. Refused means the machine answered and said no: there is no program accepting connections on that port, or a firewall actively rejected the attempt. That is different from a timeout, where nothing answers at all, and from a DNS error, where the name could not be found.

On localhost, most likely first

  • The dev server is not running, crashed on startup, or you stopped it.
  • It runs on a different port than the one you opened. Vite uses 5173, many Node and React setups use 3000, others 8080.
  • It runs inside a container or virtual machine and listens on 127.0.0.1 inside it, which is unreachable from your host. Bind to 0.0.0.0 and publish the port.
  • You opened https:// for a server that only speaks http://, or the reverse. Check what is actually listening:
# macOS and Linux
lsof -iTCP -sTCP:LISTEN -n -P | grep node
# Windows
netstat -ano | findstr LISTENING

In production

  • The web server or app process is down.
  • The app listens on a port the platform or proxy does not route to.
  • A firewall or security group does not allow ports 80 and 443 from the internet.
  • DNS points the domain at the wrong server, one that runs nothing on that port.
  • A CDN in front of you shows its own error instead, so a direct refusal usually means you are hitting the origin without a CDN.

How to fix it

Test the port directly, from outside your network for production:

curl -v http://localhost:5173
curl -v https://example.com

A refused connection appears as connection refused in the first lines of output, before any HTTP exchange.

  • Start or restart the service and read its startup output for errors.
  • Make the port in your browser match the port in the server's output.
  • In containers, bind to 0.0.0.0 and map the port when you run the container.
  • In production, confirm the process is running, the firewall allows 443, and DNS resolves to the right server.

If a page loads but some images, scripts or API calls fail with connection refused, the page is calling a service on a port or host that is not reachable from the visitor, such as an API still pointing at localhost.

If you are a visitor

Try another network. If the site works there, a local firewall, antivirus, VPN or proxy setting is blocking it. If it fails everywhere, the site is down.

What a scan can and cannot tell you

WebAuditOS cannot scan a site that refuses connections: the scan stops at the start URL. On a site that loads, it reports failed subresource requests, which is how a frontend calling a localhost API or a dead service shows up, and checks that the site is served over HTTPS.

A scan cannot see your local machine or servers that are not exposed to the internet.

A production frontend that calls http://localhost for its API works on your laptop and fails for every visitor. Failed request findings are often exactly this.

Short answers

Is ERR_CONNECTION_REFUSED the same as a timeout? No. Refused means something answered no. A timeout means nothing answered.

Why does localhost refuse after I closed my terminal? Closing the terminal stopped the dev server.

Why does my Docker app refuse connections? It probably listens on 127.0.0.1 inside the container. Bind to 0.0.0.0 and publish the port.

Can a VPN cause it? Yes, for local addresses and some corporate networks.

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.