Find out why your server hangs up on Chrome

ERR_CONNECTION_CLOSED means the other end closed the connection the normal way, with a TCP FIN, at a point where Chrome still expected more, and the page says the site unexpectedly closed the connection. On an HTTPS site, look first at the TLS handshake: a server or proxy that reads Chrome's opening message and then hangs up, instead of sending its certificate, produces exactly this error.

Where the connection gets closed

  • During the HTTPS handshake

    Chrome sends its first TLS message and the server ends the connection without answering. Whatever handles HTTPS read the message and chose not to go on, which can happen when it has no site or usable certificate for the hostname Chrome asked for.

  • At a proxy or filter in between

    A load balancer, CDN or firewall that inspects traffic can close a connection it decides to block or can't pass on to your server. The close then comes from that layer, and your web server never sees the request.

  • When the HTTPS process exits

    If the program terminating HTTPS restarts or quits after reading Chrome's message, its connections end with it. Because nothing was left unread, the operating system closes them cleanly, and Chrome reports a close rather than a reset.

  • On the visitor's computer

    Antivirus, VPN or proxy software that intercepts HTTPS can hang up before the connection ever reaches your server. Chrome's error page for this code suggests checking firewall and proxy settings.

net_error_list.h ties this error to a TCP FIN. During a handshake, Chromium turns the end of the stream into ERR_CONNECTION_CLOSED in socket_bio_adapter.cc, and localized_error.cc adds the firewall and proxy suggestions to its error page. RFC 9112 lets a client, server or proxy close a connection at any time.

Check whether the handshake finishes

# subject= means the server sent its certificate; an alert line means it refused the handshake
# "no peer certificate available" with no alert line above it means it hung up first
openssl s_client -connect yoursite.com:443 -servername yoursite.com </dev/null 2>&1 \
  | grep -E '^subject=|no peer certificate|unexpected eof|alert'

# Ask the same server for another hostname you serve (www here) and compare
openssl s_client -connect yoursite.com:443 -servername www.yoursite.com </dev/null 2>&1 \
  | grep -E '^subject=|no peer certificate|unexpected eof|alert'

Read what openssl prints

  • A subject= line means the handshake got as far as the certificate, so the close happens later, after the request; the empty response guide, linked below, covers that stage. No peer certificate available, with no alert line above it, means the server closed the connection before sending a certificate; OpenSSL 3 and later also print unexpected eof while reading. That's the case Chrome reports as ERR_CONNECTION_CLOSED. If an alert line appears above it, the server refused the handshake with an alert, which Chrome reports with an SSL code instead, such as ERR_SSL_UNRECOGNIZED_NAME_ALERT for a hostname the server doesn't recognize, as openssl_ssl_util.cc shows.

  • If one hostname completes the handshake and the other doesn't, the HTTPS setup on that server is missing a name. If neither completes, read the error log of whatever terminates HTTPS, whether that's your web server, a load balancer or a CDN, while you run the test. OpenSSL's s_client manual explains -servername, which sets the hostname the server sees during the handshake.

How to fix a connection that closes early

  1. Find the layer that terminates HTTPSWork out what answers on port 443 for the site: the web server, a load balancer or a CDN. The close comes from that layer or from something in front of it.
  2. Serve every hostname visitors useGive that layer a site and a valid certificate for each name, including the version with www and the version without it, then test each name with openssl.
  3. Read that layer's log during a testRun the openssl command while you watch the log. A rejected handshake, a crashed worker or a blocked client address can each leave a line there that names the reason.
  4. Check rules that drop clientsRate limits, bot filters and firewall rules can close connections from addresses they block. Look for your own address, or the visitor's, in their logs and lists.

Frequently asked questions

Is a stale kept-alive connection to blame?

Not if the error keeps coming back. A server may close an idle connection at any time, as RFC 9112 allows, and Chrome resends a request that failed on a reused connection, as http_network_transaction.cc shows. An error that persists means fresh connections fail too.

How can I tell if one computer is the cause?

Load the site from another device on the same network. If it works there, the cause is on the first computer, not your server.

What does Chrome show when the server closes after the handshake?

When the handshake finishes and the server then hangs up without sending a byte of the response, Chrome reports ERR_EMPTY_RESPONSE instead. http_stream_parser.cc makes that choice for a new connection that closes before any response arrives.