SSL Handshake Failed (Error 525): Causes & How to Fix It

Key takeaway

"SSL handshake failed" means the two ends of an HTTPS connection couldn't agree on how to encrypt it, so it stopped before any page was sent. On a Cloudflare site it shows as Error 525: Cloudflare reached the site's own server, but the handshake there failed. The usual causes are no valid certificate on that server, port 443 closed, no SNI, or no shared TLS version or cipher. Visitors can only wait; the site's owner fixes the server.

Check it now

SSL handshake failed explained: the TLS handshake between Cloudflare and the origin server breaking, Error 525
SSL handshake failed explained: the TLS handshake between Cloudflare and the origin server breaking, Error 525
Start reading
  1. What Does SSL Handshake Failed Mean?
  2. Where You See "SSL Handshake Failed"
  3. Cloudflare Error 525: Why It Happens
  4. How to Fix It as a Visitor
  5. Test the Handshake Yourself
  6. How to Fix It on Your Server
  7. Frequently Asked Questions

What Does SSL Handshake Failed Mean?

Before a page is sent over HTTPS, the two sides run a short exchange called the TLS handshake (TLS is today's name for SSL). The client offers the TLS versions and cipher suites it supports, the server picks one and sends its certificate, and both confirm the keys. If they can't agree, one side sends an alert and closes the connection. The handshake failed, and no page loads.

The most common alert is handshake_failure. The TLS 1.3 standard defines it as the sender being "unable to negotiate an acceptable set of security parameters given the options available". (RFC 8446) Other alerts name a more specific problem:

TLS alerts as RFC 8446 §6.2 defines them; the right column is a typical cause, not part of the standard.
Alert (number)What it meansOften behind it
handshake_failure (40)No acceptable set of security parametersNo shared cipher suite or TLS version
protocol_version (70)The version is recognized but not supportedA client or server stuck on TLS 1.0 or 1.1
insufficient_security (71)The server wants stronger parameters than the client offersOld ciphers on the client
unrecognized_name (112)No site with the name sent in SNIThe server has no site or certificate for that name
certificate_required (116)The server wanted a client certificate and got noneA server that requires client certificates
bad_certificate (42)A certificate was corrupt or its signatures didn't verifyA broken or wrongly installed certificate

Where You See "SSL Handshake Failed"

The same failure has a different name in every program. What matters is which two sides couldn't agree:

Chromium's net_error_list.h, curl's libcurl-errors and Oracle's Java documentation.
WhereWhat it saysWho couldn't agree
A site behind CloudflareError 525: SSL handshake failedCloudflare and the site's own server
Chrome, EdgeERR_SSL_PROTOCOL_ERROR (-107)Your browser and the site
Chrome, EdgeERR_SSL_VERSION_OR_CIPHER_MISMATCH (-113)Your browser and the site: no shared version or cipher
curlError 35, CURLE_SSL_CONNECT_ERRORcurl and the server
Java appsSSLHandshakeExceptionThe app and the server

Chromium defines -107 as "An SSL protocol error occurred" and -113 as "The client and server don't support a common SSL protocol version or cipher suite". (Chromium) curl's error 35 is "A problem occurred somewhere in the SSL/TLS handshake" (curl), and Java's exception means "the client and server could not negotiate the desired level of security". (Oracle)

Cloudflare Error 525: Why It Happens

Cloudflare sits between visitors and the site's own server, called the origin. Like Error 520, Error 525 is about the connection behind Cloudflare, not yours. Error 525 appears only when two things are true: the handshake between Cloudflare and the origin fails, and the site's SSL/TLS encryption mode is Full or Full (strict), the modes in which Cloudflare connects to the origin over HTTPS. (Cloudflare)

Cloudflare names four common causes at the origin:

  • No valid SSL certificate is installed.
  • Port 443 (or the custom secure port) isn't open.
  • No SNI support, so the server can't tell which site's certificate to send when several sites share one IP address.
  • The cipher suites Cloudflare uses don't match any the origin supports.

The two modes ask different things of the origin. Full needs any certificate on port 443, even a self-signed one. (Cloudflare) Full (strict) also needs it unexpired, issued by a public CA or Cloudflare's Origin CA, and matching the hostname. (Cloudflare) A certificate that fails those checks gives a different error, 526: "Cloudflare is unable to verify the SSL certificate on your origin server". (Cloudflare)

How to Fix It as a Visitor

If you see Error 525, the problem is between Cloudflare and the site's server, so no setting on your device changes it. Reload in a few minutes, and if it lasts, tell the site's owner: they're the only one who can fix it.

If your browser shows its own error instead, the handshake failed between your browser and the site. The guides for ERR_SSL_PROTOCOL_ERROR and ERR_SSL_VERSION_OR_CIPHER_MISMATCH cover what you can try on your side.

Test the Handshake Yourself

Check the server from outside your own network. The SSL Checker below makes its own handshake with the site and shows the TLS versions and ciphers it accepts, the certificate chain and whether the name matches.

Check a site's TLS handshake

On a Cloudflare site, any outside check meets Cloudflare, not your origin. Test the origin directly from a terminal: curl's --resolve sends the request to an address you choose, "a sort of /etc/hosts alternative" (curl), and openssl's -servername sets the SNI name the origin needs to pick the right certificate. (OpenSSL)

Test the origin directly (use your origin's IP)
curl -v --resolve example.com:443:203.0.113.10 https://example.com/
openssl s_client -connect 203.0.113.10:443 -servername example.com

How to Fix It on Your Server

Work through Cloudflare's four causes on the origin, in this order:

  • Install a valid certificate for every name the site serves. On a Cloudflare site, a free Cloudflare Origin CA certificate works for the origin.
  • Open port 443 in the server's firewall and your host's. A port checker shows whether it answers from outside.
  • Turn on TLS 1.2 and TLS 1.3, and turn off TLS 1.0 and 1.1, which RFC 8996 forbids.
  • Check SNI: with several sites on one IP, each name must get its own certificate. Inspect the one the server sends with a certificate decoder.
  • Offer cipher suites Cloudflare supports, then test again.

If 525s come and go rather than every time, read the origin's TLS error log at the moments they happen: Cloudflare points to Apache's mod_ssl log and nginx's error log, which may need a higher log level. (Cloudflare) A certificate chain that's missing an intermediate shows up as a verification error rather than a failed handshake; see how the certificate chain works.

Does your server's TLS handshake work?

DNS Robot's free SSL Checker makes a real TLS handshake with any site and shows the versions and ciphers it accepts, its certificate chain and whether the name matches.

Sources

  1. Error 525, Cloudflare
  2. Error 526, Cloudflare
  3. Encryption modes, Cloudflare
  4. Full (strict), Cloudflare
  5. Flexible, Cloudflare
  6. RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3, IETF
  7. RFC 8996: Deprecating TLS 1.0 and TLS 1.1, IETF
  8. net_error_list.h, Chromium
  9. libcurl error codes, curl
  10. curl man page (--resolve), curl
  11. openssl-s_client, OpenSSL
  12. SSLHandshakeException, Oracle

Frequently Asked Questions

What does SSL handshake failed mean?

The two ends of an HTTPS connection couldn't agree on how to encrypt it, so the connection closed before any page was sent. Usually they share no TLS version or cipher suite, or the server has no certificate for the name that was asked for.

What is Cloudflare Error 525?

Error 525 means the SSL handshake between Cloudflare and the site's own server, the origin, failed. It appears only when the site uses Cloudflare's Full or Full (strict) encryption mode. The fix is on the origin: a valid certificate, port 443 open, SNI support and cipher suites Cloudflare supports.

Is Error 525 my fault as a visitor?

No. Your device reached Cloudflare fine; the handshake that failed is between Cloudflare and the website's server. Nothing on your phone or computer changes it. Reload later, and if it lasts, tell the site's owner.

What's the difference between Error 525 and Error 526?

Error 525 means the handshake with the origin failed outright. Error 526 means the handshake worked but Cloudflare couldn't verify the origin's certificate, which happens in Full (strict) mode when the certificate is expired, self-signed or doesn't match the hostname.

Does switching Cloudflare to Flexible fix Error 525?

It makes the error disappear, because Cloudflare then reaches your origin over plain HTTP, but traffic between Cloudflare and your server is no longer encrypted. Cloudflare recommends Full or Full (strict). Install a certificate on the origin instead.

How do I fix an SSL handshake failure in Chrome?

Chrome shows it as ERR_SSL_PROTOCOL_ERROR or ERR_SSL_VERSION_OR_CIPHER_MISMATCH. Check whether other browsers and devices reach the site, update an old browser or system, and if every device fails, the site's server is the problem. Our guides for those two errors walk through each step.

What does curl error 35 mean?

curl's error 35, CURLE_SSL_CONNECT_ERROR, means a problem occurred somewhere in the SSL/TLS handshake. Run curl with -v to see how far the handshake got and which alert the server sent, then match the alert to its cause.

Which TLS versions should a server support?

TLS 1.2 and TLS 1.3. RFC 8996 deprecated TLS 1.0 and 1.1 in 2021 and says they MUST NOT be used, so a server limited to them fails with modern clients, and a client limited to them fails with up-to-date servers.

About the author

Shaik Vahid

Founder of DNS Robot. Vahid spent years in web hosting support fixing domains, DNS records, SSL certificates and email delivery for customers. He builds DNS Robot's tools and writes these guides from the errors people actually hit.

SSL Certificate Check

Verify SSL certificate validity and security details