Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

What the Error Means

When a browser reaches an https site through an HTTP proxy, it cannot hand the encrypted traffic to the proxy directly. It first sends the proxy a CONNECT request that asks for a raw tunnel to the site's host and port. If the proxy refuses, cannot reach the site, or does not answer properly, Chrome stops with ERR_TUNNEL_CONNECTION_FAILED. The site's server may never have seen the request.

How CONNECT Works

The browser sends the proxy something like this:

CONNECT example.com:443 HTTP/1.1
Host: example.com:443

A proxy that agrees opens a TCP connection to the site and replies with a 2xx status. From then on it passes bytes in both directions, and the TLS handshake happens through the tunnel. Any other reply ends the attempt.

What a Visitor Can Try

  • Proxy settings: if a proxy is set in the browser or the device's network settings and you do not need one, turn it off, including automatic proxy configuration.
  • VPN: disconnect it and test; a VPN client that also sets a proxy is a common cause.
  • Extensions: some extensions route traffic through their own proxy; test in a private window without them.
  • Another network: an office or school network may force a proxy that blocks the site on purpose. Ask its administrator.

Test the Proxy with curl

From a Linux machine, send a request through the proxy and read the reply to the CONNECT line:

curl -v -x http://proxy.example.net:3128 https://example.com/
Proxy replyMeaning
200Tunnel open
403Denied by a rule
407Proxy needs a login
502 or 503Usually cannot reach the site
No replyProxy down or blocked

Compare with a request that bypasses the proxy: curl -sI https://example.com/. If that works, the site is fine and the proxy is the problem.

When You Run the Proxy: Access Rules

Forward proxies usually allow CONNECT only to a short list of ports, because an open tunnel to any port can be misused. In Squid, the sample configuration contains these lines (the CONNECT ACL is predefined):

acl SSL_ports port 443
http_access deny CONNECT !SSL_ports

A site on another port, such as 8443, is refused until you add that port to the list, for example with a second line acl SSL_ports port 8443. Check the configuration and reload:

sudo squid -k parse
sudo systemctl reload squid

The proxy's access log shows each refused request with the rule outcome; search it for the site's name.

When You Run the Proxy: Is It Up?

sudo systemctl status squid
sudo ss -ltnp | grep 3128

Port 3128 is Squid's usual listening port; use yours if http_port sets another. A proxy that cannot be reached at all often gives a different browser error about the proxy connection. If the service is running but the tunnel still fails with a 502 or 503, test from the proxy machine itself whether it can reach the site and resolve its name. A firewall on the proxy that blocks outbound traffic to port 443 gives the same result. See the ss command for reading listening sockets.

Forward Proxy, Reverse Proxy, and SSH

This error is about a forward proxy, one that acts for the visitor. A reverse proxy in front of a website, such as Nginx, does not use CONNECT; see what a reverse proxy is. If you only need a private way to browse through your server, SSH dynamic forwarding gives you a SOCKS proxy without installing a proxy server; see SSH port forwarding.

If Nothing Works

Remove every proxy and VPN, use another network, and test again. If the site still does not load, the problem is no longer the tunnel; see this site can't be reached.

Was this answer helpful?
Loading...