ERR_CONNECTION_REFUSED: How to Fix It on Chrome, Windows, Mac, Android & iPhone

ERR_CONNECTION_REFUSED means the browser reached the target host, but nothing accepted the TCP connection on the requested port (usually 80 or 443). Either the service is not running or listening, a firewall actively rejects the port, or the browser is being sent to the wrong host or port by DNS, the hosts file, a proxy or a VPN. If it fails only on your device, look at local causes. If it fails everywhere, the server is the problem.

Quick checks

  • Open the site on mobile data or another device. If it works there, the cause is local (browser, VPN, proxy, hosts file, DNS).
  • Open the URL in a private/incognito window with extensions disabled.
  • Test the port directly: curl -sv https://example.com -o /dev/null. Output Connection refused means nothing accepted the connection on that port.
  • If you own the server, run sudo ss -ltnp | grep -E ':(80|443)\s' to confirm something is listening.
  • Think about what changed just before the error: DNS, SSL, migration, firewall rule, deployment, tunnel config.

What is ERR_CONNECTION_REFUSED?

It is a browser connection error. The browser opened a TCP connection, and the target host replied with a reset (RST) instead of accepting it. This is different from a timeout:

  • Timeout: the other side never answered (packets dropped or the host is unreachable).
  • Connection refused: the host answered, but no service accepted connections on that port, or a firewall used REJECT.

Chrome shows it like this:

This site can’t be reached
The connection was refused
ERR_CONNECTION_REFUSED

Causes and fixes

1. The web server or app is not running

The host is up, but Nginx, Apache, the app process or the container is stopped or crashed.

How to check:

sudo systemctl status nginx      # or apache2 / httpd / php8.2-fpm
docker ps -a                     # look for Exited containers
curl -sv http://127.0.0.1/ -o /dev/null

This is the cause if the service shows inactive (dead) or failed, the container shows Exited, or the local curl also returns Connection refused.

How to fix:

sudo nginx -t && sudo systemctl restart nginx
sudo systemctl enable nginx      # start on boot
sudo journalctl -u nginx -n 50 --no-pager   # why it stopped
docker start <container>        # or: docker compose up -d

For a local dev server (localhost:3000 and similar), start it again (npm run dev and so on) and check the port it prints.

2. The service listens on the wrong port or interface

The app runs, but on 8080 instead of 80, only on 127.0.0.1, only on IPv4, or HTTPS was never set up on 443.

How to check:

sudo ss -ltnp
# Good:   LISTEN 0 511 0.0.0.0:443  ...  users:(("nginx",...))
# Bad:    LISTEN 0 511 127.0.0.1:8080 ...  (only local, wrong port)
curl -sv http://example.com  -o /dev/null
curl -sv https://example.com -o /dev/null

This is the cause if nothing is listed on :80/:443, the listener is bound to 127.0.0.1 only, or HTTP works while HTTPS is refused.

How to fix: Add the missing listener. For Nginx:

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name example.com;
    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
}

For Apache, make sure Listen 443 is in ports.conf and mod_ssl is on (sudo a2enmod ssl && sudo systemctl reload apache2). For Node, Python and similar apps, bind to 0.0.0.0 (or put them behind a reverse proxy) instead of 127.0.0.1. If the domain has an AAAA record, the server must also listen on IPv6.

3. A firewall rejects the port

UFW, iptables or nftables, a hosting or cloud security group, or Windows Defender Firewall rejects the traffic. A REJECT rule shows up as “refused”. A DROP rule shows up as a timeout.

How to check:

sudo ufw status verbose
sudo iptables -L INPUT -n --line-numbers | grep -E 'REJECT|DROP'
# from outside the server:
nc -vz example.com 443

This is the cause if the service listens on 0.0.0.0:443 and curl https://127.0.0.1 -k works on the server, but nc from outside is refused.

How to fix:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
# or with iptables:
sudo iptables -I INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT

Also open 80 and 443 in your provider’s firewall or security group panel. Behind Cloudflare, allow Cloudflare’s IP ranges.

4. VPN, proxy or browser extensions interfere

The site is fine, but a local layer reroutes or blocks the connection. This is likely when only one device or browser profile fails.

How to check: Disable the VPN, then look at proxy settings: Chrome chrome://net-internals/#proxy, Windows netsh winhttp show proxy, macOS System Settings → Network → Proxies. Test in a private window with extensions off.

This is the cause if the site loads once the VPN, proxy or extension is turned off.

How to fix: Turn off the manual proxy (Windows: netsh winhttp reset proxy), remove or reconfigure the extension, or add the site to the VPN’s split-tunnel exclusions.

5. DNS or the hosts file points to the wrong host

The domain resolves to an old server, a staging IP, 127.0.0.1, or an AAAA record for a host that does not serve the site.

How to check:

dig +short example.com A
dig +short example.com AAAA
nslookup example.com 1.1.1.1
# hosts file:
#   Linux/macOS: /etc/hosts
#   Windows:     C:\Windows\System32\drivers\etc\hosts

This is the cause if the IPs don’t match your current server, the hosts file has an entry for the domain, or only IPv6 fails (curl -6 -sv https://example.com refused, curl -4 works).

How to fix: Remove stale lines from the hosts file. Fix or delete the wrong A or AAAA records at your DNS provider. Then flush the local DNS cache:

ipconfig /flushdns                                   # Windows
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder   # macOS
sudo resolvectl flush-caches                         # Linux (systemd-resolved)

In Chrome, also clear chrome://net-internals/#dns. If the error started after a DNS change, see This site can’t be reached.

6. Browser cache or stale state

Cached redirects (for example an HSTS redirect to HTTPS on a site without a 443 listener), cookies or sockets make one site fail in one browser.

How to check: If the site works in a private window or another browser, but not in your normal profile, this is the cause.

How to fix: Clear the site data (padlock icon → Site settings → Clear data). Flush sockets at chrome://net-internals/#sockets. Restart the browser fully. If HSTS forces HTTPS on a dev domain, delete it at chrome://net-internals/#hsts.

7. Reverse proxy, CDN or tunnel points to a dead upstream

Nginx, HAProxy, Traefik, Docker or a Cloudflare Tunnel forwards traffic to a backend port that is wrong or not listening. Inside containers, localhost means the container itself, not the host.

How to check:

sudo tail -n 50 /var/log/nginx/error.log
# connect() failed (111: Connection refused) while connecting to upstream ...
grep -R "proxy_pass\|upstream" /etc/nginx/
curl -sv http://127.0.0.1:3000/ -o /dev/null      # the upstream port
docker compose ps                                  # published ports

This is the cause if the proxy log shows 111: Connection refused to the upstream, or the upstream port doesn’t answer on curl. Behind Cloudflare, the same failure appears as Cloudflare Error 521.

How to fix: Point the proxy at the port the app actually uses, then reload:

location / {
    proxy_pass http://127.0.0.1:3000;   # in Docker: http://app:3000 (service name)
}
sudo nginx -t && sudo systemctl reload nginx

For a Cloudflare Tunnel, fix service: http://localhost:<port> in config.yml (or the Public Hostname in Zero Trust) and restart cloudflared.

8. A corporate or ISP network blocks the connection

How to check: If the site works on mobile data but not on the office or ISP network, and other devices on that network fail too, this is the cause.

How to fix: Ask the network admin to allow the domain and port. Meanwhile, use another network.

General troubleshooting

  • Narrow the scope first: one site or many, one device or all, one network or all.
  • Restart the browser, the device and the router to clear temporary network state.
  • Check logs instead of guessing: web server, application, firewall, proxy and cloudflared logs usually name the exact refused port.
  • Change one thing at a time and retest with curl -sv after each change.

Prevention tips

  • Keep web servers and app services monitored.
  • Document which ports each service actually uses.
  • Keep firewall rules simple and reviewed after changes.
  • Test both HTTP and HTTPS after migrations.
  • Verify reverse proxy and tunnel targets after deployments.
  • Avoid stale local hosts file entries on admin machines.
  • Use one canonical public URL consistently.
  • Monitor origin health behind Cloudflare and reverse proxies.

When to contact support

  • Hosting provider: nothing listens on 80/443, a provider firewall may block traffic, or you need logs and network settings you cannot change.
  • Network admin: the site works on mobile data but not on the office network, or many sites are refused only in one managed environment.
  • Stay local: only one browser fails, private mode changes the result, a VPN or proxy is active, or the hosts file was edited.

FAQ

What does ERR_CONNECTION_REFUSED mean?

It means the browser tried to connect to a host and port, but the target system refused the connection instead of accepting it.

Is ERR_CONNECTION_REFUSED a browser problem or a server problem?

It can be either. Sometimes the cause is local, such as a VPN, proxy, extension, DNS override, or firewall. Other times the website server or backend service is down or not listening on the expected port.

How do I fix ERR_CONNECTION_REFUSED fast?

Start by checking whether the problem affects one site or many, then test in a private window, disable VPN and proxy tools, clear cache, flush DNS, and if you own the site, confirm the web server is running and listening on the correct port.

Can Cloudflare or a tunnel cause ERR_CONNECTION_REFUSED?

Yes. If the tunnel or proxy points to the wrong backend port, or the origin service is not listening, the origin connection can be refused.

Why does ERR_CONNECTION_REFUSED happen on one site only?

Usually because that site is down, misconfigured, blocked by a firewall, pointing to the wrong destination, or exposing the wrong port for the requested protocol.

Related Browser Errors

Leave a Comment