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
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.
# 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.
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
- Is Cloudflare down? Live status: checked every few minutes, with outage history.
- SSL certificate checker: Expiry date, issuer, chain and host name match.
- Website down checker: Is it down for everyone or just me? Check any site now.
Related reading
- Cloudflare error 523: origin is unreachable: Fix Cloudflare error 523 Origin is Unreachable: wrong DNS IPs, routing problems at the host and firewalls, with tests that confirm where traffic stops.
- Cloudflare error 1016 "Origin DNS error": how to fix it: Fix Cloudflare error 1016 Origin DNS error: CNAME records pointing to names that do not resolve, deleted origins and load balancer pools, with checks.
- Cloudflare error 1020: Access denied: Fix Cloudflare error 1020 Access denied: find the firewall rule that blocked a visitor using the Ray ID, tune WAF rules and allow your monitors and APIs.
- Cloudflare error 521: web server is down: Fix Cloudflare error 521 "Web server is down": the origin refused the connection. Check the web server, firewall rules for Cloudflare IPs and DNS.
- Cloudflare error 522: connection timed out: Fix Cloudflare error 522 "Connection timed out": the origin did not complete the TCP connection in time. Overloaded servers, dropped packets and wrong DNS.
- Cloudflare error 524: a timeout occurred: Fix Cloudflare error 524: the origin accepted the connection but sent no HTTP response within 100 seconds. Find the slow request and move long work off it.
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.