failover.io
  1. Home
  2. Cloudflare errors
  3. Error 525

Cloudflare error 525: SSL handshake failed

HTTP 525 from Cloudflare. TLS handshake with the origin failed: what it means, whose fault it is and how to fix it.

Updated 19 November 20265 min read

Cloudflare returns a 525 when the TLS handshake between Cloudflare and your origin server failed. It only happens when the SSL/TLS mode is Full or Full (strict), because those are the modes where Cloudflare connects to your origin over HTTPS.

Quick answer. Your origin has no valid certificate installed, port 443 is closed or blocked, the server doesn't support SNI or it shares no cipher suite with Cloudflare. Installing a free Cloudflare Origin CA certificate and making sure the server listens on 443 fixes most cases.

Is a 525 error my fault?

Where the problem isHow often
Your originYes
Cloudflare settingsSometimes
The visitorNo

The handshake fails on the second leg, between Cloudflare and your origin. The visitor reaching Cloudflare works, which is why they see Cloudflare's error page at all. The cause is the origin's TLS setup, or now and then a mismatch between that setup and the SSL mode you picked in Cloudflare.

What SSL handshake failed means here

Every request through Cloudflare uses two connections: browser to Cloudflare, then Cloudflare to your origin. The SSL/TLS mode in the Cloudflare dashboard decides how the second one works:

ModeConnection to the originPossible errors
FlexiblePlain HTTP on port 80, no certificate needed (and the traffic to your origin isn't encrypted)No 525 or 526
FullHTTPS on 443, certificate not validated, so self-signed or expired certificates work525 if the handshake fails
Full (strict)HTTPS on 443, certificate fully validated525 if the handshake fails, 526 if the certificate is rejected

A 525 means the handshake never finished. If it had finished and only the certificate was the problem, you'd see a 526.

Common causes on the origin

  1. No valid certificate is installed, or one exists but the web server doesn't use it. This is common on new servers where the HTTPS virtual host was never set up, and in cPanel before AutoSSL has run.
  2. Port 443 is closed: the web server doesn't serve HTTPS, or a firewall blocks 443 from Cloudflare's ranges. Cloudflare has nothing to handshake with.
  3. The origin doesn't support SNI. Cloudflare says which hostname it wants during the handshake, and a server that ignores that can't pick the right certificate.
  4. No shared cipher suite. Old servers that only offer outdated ciphers, or only TLS 1.0 and 1.1, fail here. Support TLS 1.2 or later with current ciphers.

How to test the handshake from the command line

  1. Run the handshake yourself from another machine, without Cloudflare: openssl s_client -connect ORIGIN_IP:443 -servername yourdomain.com. If it fails here, the origin's TLS setup is the problem.
  2. Check that the server listens on 443: ss -tlnp | grep ':443'.
  3. See which TLS versions and ciphers the origin offers with the SSL Labs test at ssllabs.com/ssltest.
  4. Read the origin's error logs at the times of the 525s. nginx writes handshake errors to its error log (set the level to info for detail); Apache writes them to its SSL error log.

To see which certificate a public hostname sends and whether it's valid, use the SSL checker.

How to fix it

Install a Cloudflare Origin CA certificate. It's free: you create it in the dashboard under SSL/TLS, Origin Server, Create Certificate. Cloudflare trusts it in Full (strict) mode. Copy the certificate and its private key onto the origin, point your web server config at them and restart. You then don't depend on a public certificate authority or AutoSSL for this connection.

Monitor your origin certificate

Many 525s start the day a certificate on the origin expires or a renewal never got loaded. Tick Enable SSL expiry check on a failover.io HTTPS monitor to get a heads up 30 days before expiry, the full alert chain at 7 days and repeated alerts at 1 day. The SSL expiry guide covers the details.

All six codes side by side: Cloudflare 5xx errors explained.

Frequently asked questions

What does Cloudflare error 525 mean?

The TLS handshake between Cloudflare and your origin failed. It happens when the SSL/TLS mode is Full or Full (strict) and the origin can't complete the encrypted connection.

How do I fix Cloudflare error 525?

Install a valid certificate on the origin, make sure it listens on port 443 and allows Cloudflare's IPs there, support SNI and TLS 1.2 or later. A free Cloudflare Origin CA certificate fixes most cases.

What causes an SSL handshake to fail?

No certificate on the server, port 443 closed, no SNI support or no cipher suite that both sides support. Behind Cloudflare, any of these shows up as error 525.

Does switching Cloudflare to Flexible fix error 525?

The error goes away, because Flexible talks to your origin over plain HTTP. But the traffic between Cloudflare and your server is then unencrypted, so install a certificate and use Full (strict) instead.