ERR_TUNNEL_CONNECTION_FAILED and ERR_PROXY_CONNECTION_FAILED: find and clear a dead proxy

Both errors mean the browser is told to go through a proxy, and the proxy lets it down. With ERR_PROXY_CONNECTION_FAILED nothing answers at the proxy's address; with ERR_TUNNEL_CONNECTION_FAILED the proxy answered but couldn't open the way to the site. Most often a proxy client such as v2rayN, Clash or NekoBox set the system proxy to 127.0.0.1, then was closed or crashed, and the setting stayed. Turn the system proxy off, and pages open.

Updated

On this page

What the two errors mean

A browser set to use a proxy doesn't go to the site itself: it asks the proxy for it, and for an https site the proxy opens a tunnel (the CONNECT method) and passes the encrypted data both ways. Each error says which half failed.

  • ERR_PROXY_CONNECTION_FAILED — the browser couldn't reach the proxy at all; Chrome's page says something is wrong with the proxy server, or the address is incorrect (Firefox: the proxy server is refusing connections). Nothing listens there: the program is closed, or the address or port is wrong.
  • ERR_TUNNEL_CONNECTION_FAILED — the proxy took the connection but answered with a failure instead of a tunnel: the program behind it lost its server, a rule blocks the site, or a work proxy doesn't allow it.

The usual cause: a proxy client left its setting behind

Proxy clients such as v2rayN, Clash-based apps and NekoBox can run as a system proxy: they open a local proxy on 127.0.0.1 and write its address into the system's settings, so browsers send everything there. Closing properly, the program is supposed to put the setting back. After a crash or an uninstall, or when told to leave the setting alone, it doesn't, and the browser keeps knocking on a port where nothing listens.

v2rayN has system proxy options, among them “Clear system proxy”, which removes the address from the system, and “Do not change system proxy”, which leaves the setting as it is, an old address included. If the browser broke after you closed v2rayN, open it and choose “Clear system proxy”, or clear the setting by hand as below. Other causes:

  • A setup script (PAC) — the system points to a script that picks the proxy, often served on 127.0.0.1 by the same kind of program.
  • A browser extension — proxy switchers set the browser's proxy on their own.
  • A work or school proxy — set by the admins, sometimes by policy; it may block sites or ask for a login. Ask them rather than change it.
  • Environment variables — http_proxy, https_proxy and all_proxy send curl, git and other terminal programs to a proxy.

What you see, why, and what to do

  • ERR_PROXY_CONNECTION_FAILED on every site after v2rayN, Clash or NekoBox was closed or crashed

    CauseThe system proxy still points at 127.0.0.1, where nothing listens now

    What to doTurn the system proxy off, or open the program and clear it there

  • ERR_TUNNEL_CONNECTION_FAILED while the proxy client is running

    CauseThe proxy answers but can't open the site: its server is down or a rule blocks the site

    What to doCheck the server in the client, or turn the system proxy off to test

  • Only one browser fails

    CauseThat browser has a proxy of its own: a Firefox setting or an extension

    What to doFirefox: “Use system proxy settings” or “No proxy”; turn proxy extensions off

  • curl, git or pip can't connect to 127.0.0.1, the browser is fine

    CauseProxy environment variables, or git's own proxy setting

    What to doRemove the variables; git config --global --unset http.proxy

  • The proxy is off and DNS_PROBE_FINISHED_NXDOMAIN shows instead

    CauseNames don't resolve: DNS, not the proxy

    What to doSee the DNS section at the end

Windows: check and turn off the proxy

Open Settings → Network & internet → Proxy. Under Manual proxy setup, “Use a proxy server” should be off: if it is on, press Edit, turn it off and save. Under Automatic proxy setup, turn “Use setup script” off if you didn't set it yourself; “Automatically detect settings” can stay on. Then restart the browser.

Windows: cmd or PowerShell
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer

The settings Chrome and Edge read. ProxyEnable 0x1 means on, 0x0 off; ProxyServer is the address, such as 127.0.0.1:10809. On, with a local port no program runs now, is the cause.

Windows: cmd or PowerShell
netsh winhttp show proxy

A separate setting, WinHTTP, for Windows services and some programs, not the browsers. Direct access (no proxy server) is normal; an address you didn't set is removed with netsh winhttp reset proxy run as administrator.

macOS: check and turn off the proxy

System Settings → Network → Wi-Fi (or the connection you use) → Details → Proxies: turn off everything you didn't set yourself, the automatic proxy configuration included. Or from Terminal:

macOS: Terminal
scutil --proxy
networksetup -getwebproxy Wi-Fi
networksetup -getsecurewebproxy Wi-Fi

HTTPEnable : 1 with HTTPProxy : 127.0.0.1, or Enabled: Yes with Server: 127.0.0.1, is a local proxy; ProxyAutoConfigEnable : 1 is a setup script. Other connections' names: networksetup -listallnetworkservices.

macOS: Terminal
networksetup -setwebproxystate Wi-Fi off
networksetup -setsecurewebproxystate Wi-Fi off
networksetup -setsocksfirewallproxystate Wi-Fi off
networksetup -setautoproxystate Wi-Fi off

Turns off the HTTP, HTTPS and SOCKS proxies and the setup script. If it asks for rights, put sudo in front.

Linux and Android

On Linux with GNOME the system proxy is in Settings → Network → Proxy, and in gsettings:

Linux (GNOME): Terminal
gsettings get org.gnome.system.proxy mode
gsettings set org.gnome.system.proxy mode 'none'

The first line shows the mode: 'none' no proxy, 'auto' a setup script, 'manual' a proxy address. The second turns the proxy off; restart the browser if it doesn't notice.

  • Android — Settings → Wi-Fi, open the network you're on (tap it or its gear icon), then Edit or Advanced options → Proxy → None; the path differs a little from phone to phone. The proxy belongs to that one network, so mobile data may work while this Wi-Fi fails.

The browser and the terminal

Chrome and Edge follow the system proxy. What they really use is on chrome://net-internals/#proxy (in Edge edge://net-internals/#proxy), and a proxy set by an organization's policy shows on chrome://policy.

Firefox has its own setting in Settings → General → Network Settings → Settings, where “Manual proxy configuration” keeps an address that outlives the program that needed it: choose “Use system proxy settings” or “No proxy”. Proxy extensions work past the system too: turn them off and try again.

macOS and Linux: Terminal
env | grep -i proxy

A line such as https_proxy=http://127.0.0.1:10809 sends terminal programs there. unset http_proxy https_proxy all_proxy clears them for this window (the capital names too); for good, remove them from ~/.bashrc, ~/.zshrc or ~/.profile.

Windows: PowerShell
Get-ChildItem Env: | Where-Object Name -like '*proxy*'

Shows proxy variables. Permanent ones are removed in “Edit environment variables for your account” (search for it in Start).

DNS_PROBE_FINISHED_NXDOMAIN with a VPN

This one is not about the proxy: the site's name didn't resolve to an address. With a VPN on it is usually DNS: the DNS server the VPN uses doesn't answer, or doesn't know names that exist only in your local network, such as the router's page or a work site. Without a VPN, check the name for a typo first.

Windows, macOS and Linux
nslookup example.com
nslookup example.com 1.1.1.1

The first asks the system's current DNS, the second asks 1.1.1.1. If only the second finds an address, change the DNS in the VPN client or the system; if neither does, the name doesn't exist. On Windows, ipconfig /flushdns clears the cache of names afterwards.

In Veli

Veli doesn't use the system proxy

Veli brings up a virtual network adapter and takes the traffic of the whole system through it, not just the browser's. It doesn't set the system proxy and doesn't clear one either. So if you moved to Veli from v2rayN, Clash or NekoBox and the browser shows ERR_PROXY_CONNECTION_FAILED with Veli connected, it is the old program's proxy: the browser still knocks on 127.0.0.1, which never reaches the tunnel. Turn that proxy off as above.

If pages still don't open, “Diagnostics” → “Check everything” looks at the network itself: profiles from this network, DNS, internet access, the clock, MTU and the VPN server; proxy settings aren't among its checks. For a profile from a link, DNS goes through the tunnel to 1.1.1.1 unless you list other servers on the profile's “Routes and DNS” tab.

FAQ

What does ERR_TUNNEL_CONNECTION_FAILED mean?

The browser reached its proxy, but the proxy couldn't open the connection to the site: a VPN client whose server stopped working, or a work proxy that blocks the site.

How do I fix ERR_PROXY_CONNECTION_FAILED after closing v2rayN?

Open v2rayN again and choose Clear system proxy, or turn off Use a proxy server in Windows Settings → Network & internet → Proxy. Then restart the browser.

What is the difference between Clear system proxy and Do not change system proxy in v2rayN?

Clear system proxy removes the proxy address from the system's settings. Do not change system proxy leaves the settings as they are, so an address written there earlier stays.

Can a VPN cause DNS_PROBE_FINISHED_NXDOMAIN?

Yes: with the VPN on, the VPN's DNS resolves names, and if it doesn't answer or doesn't know a local name, the browser shows this error. Compare nslookup with the system's DNS and with 1.1.1.1.

Do I need to clear the proxy before using Veli?

Yes, if it points at a program that no longer runs. Veli doesn't use or change the system proxy, so the browser would keep going to the dead address.

A VPN for the whole system, with no proxy to clean up

Veli takes all traffic through a virtual adapter instead of the system proxy, so nothing is left in the proxy settings after it.