Skip to content

Troubleshooting guide

Cloudflare error 525: SSL handshake failed

A 525 means Cloudflare connected to your origin, but the two could not complete a TLS handshake. The fault is between Cloudflare and your server, not with the visitor.

3 min read10 sectionsUpdated

On this page

Key points

  • Only appears in Full or Full (strict) mode, where Cloudflare talks HTTPS to the origin.
  • The origin must listen for TLS on 443 with a certificate.
  • SNI matters: Cloudflare sends the hostname.
  • Switching to Flexible hides the bug and weakens security.

What 525 means

In Full modes, Cloudflare opens its own TLS connection to your origin. A TCP connection succeeded, so the server is up, but TLS negotiation failed. Typically the origin has no suitable certificate configuration or no shared protocols and ciphers.

Common causes

  • No certificate or no TLS on port 443 at the origin.
  • No SNI handling. Your server has no block for that hostname.
  • No shared cipher or TLS version. An old server may not offer any that Cloudflare accepts.
  • A firewall or fail2ban cutting the handshake from some Cloudflare IPs.
  • A web server restart that left the certificate unreadable.

Diagnose it

Test TLS directly against the origin IP, and pass the same hostname Cloudflare would send.

bash
# Handshake to the origin, with SNI
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>&1 | grep -E 'Protocol|Cipher|Verif|alert'

# Which TLS versions work?
for v in tls1_2 tls1_3; do echo "$v: $(openssl s_client -connect 203.0.113.10:443 -servername example.com -$v </dev/null 2>/dev/null | grep -c 'Cipher is')"; done

# Is Nginx configured for that name?
sudo nginx -T 2>/dev/null | grep -E 'listen .*443|server_name|ssl_certificate '

Fixes

Install a certificate on the origin. A free Cloudflare Origin CA certificate is a good choice when all traffic goes through Cloudflare. Listen on 443 with ssl and set server_name for your hostname. Enable TLS 1.2 and 1.3. Allow Cloudflare's IP ranges through your firewall. Do not change to Flexible mode as a fix, since visitors would still see a padlock while traffic to your origin travels unencrypted.

Catch it automatically

Monitor the origin's certificate separately from the public one, as Cloudflare's edge certificate can look fine while the origin's is broken or expired. A public SSL check plus an origin check covers both.

Frequently asked questions

Should I switch to Flexible to fix 525?

No. It removes encryption between Cloudflare and your server. Install a certificate on the origin instead.

What is a Cloudflare Origin CA certificate?

A free certificate trusted only by Cloudflare, for encrypting traffic between Cloudflare and your server. Visitors never see it directly.

What is the difference between 525 and 526?

525 means the TLS handshake failed. 526 means it succeeded, but the certificate could not be validated.

Check it now, free

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.