Cloudflare error 525 means Cloudflare tried to open an encrypted connection to your origin server and the handshake failed. The handshake is the opening exchange of Transport Layer Security (TLS), the protocol behind HTTPS. The error only appears when your SSL/TLS mode is Full or Full (strict), because those are the modes where Cloudflare speaks TLS to the origin. Cloudflare’s documentation lists four common causes: no valid certificate on the origin, port 443 closed, no Server Name Indication (SNI) support, or no shared cipher suite. One openssl s_client command against the origin usually shows which one you have.
What’s happening
Your hostname is proxied, so visitors connect to Cloudflare and Cloudflare connects to your origin. In Full or Full (strict) mode, an HTTPS request from a visitor makes Cloudflare use HTTPS to the origin too. Cloudflare connects to port 443 and sends the hostname through SNI. The origin must answer with a certificate and agree on a protocol version and a cipher suite.
A 525 is Cloudflare reporting that this exchange failed. Error 526 is different: the handshake completes, but the certificate fails validation in Full (strict) mode. Cloudflare documents both on its error 525 and error 526 pages.
In Flexible mode, Cloudflare connects to the origin over plain HTTP, so a 525 cannot happen. That is why switching to Flexible seems to fix the error. It really removes encryption between Cloudflare and your origin. The trade-offs are explained in Flexible vs Full vs Full (Strict).
A 525 can also be intermittent. For that case, Cloudflare recommends reading the origin’s TLS error logs at the times the errors occur.
What to check first
- Did the SSL/TLS mode change recently? Moving from Flexible to Full against an origin with no TLS configured produces 525s across the whole site.
- Did a certificate renew or expire recently? A renewal that was only half deployed can leave the web server unable to load its TLS configuration.
- Is anything listening on port 443? A web server configured only for port 80 cannot complete a handshake.
- Is the error constant or intermittent? A constant error points to configuration. An intermittent one points to something that changes over time, such as load.
- Did you move the site to a new server recently? See After a cPanel migration below.
How to verify
Test the handshake the way Cloudflare performs it: against the origin IP address, with SNI. Replace 203.0.113.10 with your origin IP and example.com with your hostname.
# Does the origin complete a TLS handshake for this hostname?
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>&1 \
| openssl x509 -noout -subject -issuer -dates
# Without SNI: does the default site answer differently, or reject?
openssl s_client -connect 203.0.113.10:443 </dev/null 2>&1 | head -15
# Which protocol and cipher get negotiated (or refused)?
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>&1 \
| grep -E 'Protocol|Cipher'
# Is port 443 open, or is it filtered or closed?
nc -vz -w 10 203.0.113.10 443
# Full request against the origin, ignoring certificate trust for now
curl -skv --resolve example.com:443:203.0.113.10 https://example.com/ -o /dev/null 2>&1 \
| grep -E 'TLS|SSL|error'
# Which SSL/TLS mode is the zone in? "full" is Full, "strict" is Full (strict)
curl -s "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/settings/ssl" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
# On the origin: do the certificate and private key belong together?
# The two hashes must be identical.
openssl x509 -in /etc/ssl/example.com/fullchain.pem -noout -pubkey | openssl sha256
openssl pkey -in /etc/ssl/example.com/privkey.pem -pubout | openssl sha256
Read each failure carefully:
Connection refusedmeans nothing is listening on port 443. Fix the web server before you look at the certificate. Cloudflare often reports a refused connection as error 521 instead.- An immediate
handshake failurealert points to a cipher, protocol or SNI problem. - A printed certificate means the handshake works from where you are testing. If Cloudflare still returns 525, check the origin’s TLS error logs for the same timestamps. Also check whether a firewall or load balancer treats Cloudflare’s connections differently.
The fix
- Nothing serves TLS on port 443. The web server has only a port 80 site, or its TLS site failed to load because a certificate path is wrong. Add or repair the port 443 configuration. In Nginx, that means
listen 443 ssl;,ssl_certificateandssl_certificate_key. In Apache, it means a port 443 virtual host withSSLEngine on. Test the configuration, reload, and run theopenssltest again. - No certificate for the requested hostname. The origin serves TLS but has no site that matches the SNI name, so the handshake is rejected. Install a certificate that covers the hostname. For an origin that only receives proxied traffic, you can use a Cloudflare Origin CA certificate. Origin CA is Cloudflare’s own certificate authority (CA). You create the certificate under SSL/TLS → Origin Server in the dashboard.
- Certificate and key do not match after a renewal. A new certificate was deployed with the old private key, so the web server cannot load the pair. Compare the two hashes from the last check above. Deploy the certificate and its key together, then reload the web server.
- No shared cipher suite. Cloudflare publishes the cipher suites it offers to origin servers. If your origin accepts none of them, the handshake fails. Run
nmap --script ssl-enum-ciphers -p 443 203.0.113.10to list what the origin accepts. Then enable TLS 1.2 and TLS 1.3 with a standard cipher list. - Intermittent failures. Look at the origin’s error logs for the times the 525s occurred. Nginx writes TLS errors to its error log, and you may need a higher log level to see them. Apache needs logging turned up for
mod_ssl. If the failures follow traffic peaks, check the processor and connection limits of whatever terminates TLS.
Error 526: the handshake works, the certificate fails
Error 526 looks similar but has a different cause. With a 525, the handshake itself fails. With a 526, the handshake completes, and then Cloudflare rejects the origin’s certificate.
A 526 appears only in Full (strict) mode, because that is the mode where Cloudflare validates the certificate. According to Cloudflare’s error 526 page and its Full (strict) requirements, validation fails when the certificate:
- has expired, or is not valid yet
- has been revoked
- does not list the requested hostname in its Common Name or Subject Alternative Name (SAN)
- is self-signed, or does not chain to a CA that Cloudflare trusts
A Cloudflare Origin CA certificate passes this validation. So does a certificate from a publicly trusted CA, as long as the origin also serves the intermediate certificates.
Check the dates and names with one command:
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName
Example output:
subject=CN = example.com
issuer=C = US, O = Let's Encrypt, CN = R12
notBefore=Aug 14 09:21:07 2026 GMT
notAfter=Nov 12 09:21:06 2026 GMT
X509v3 Subject Alternative Name:
DNS:example.com
In this example, notAfter is in the past, so the certificate has expired. The name list also leaves out www.example.com. For the full fix, see Cloudflare error 526: invalid SSL certificate.
After a cPanel migration
A 525 or 526 that starts right after you move a site to a new cPanel server usually has one of four causes.
- The DNS record points at the wrong server. In the Cloudflare dashboard, check that the A and AAAA records for the hostname hold the new origin IP address. An old record sends Cloudflare to the old server, where the account or its certificate may be gone.
- AutoSSL has not issued a certificate yet. AutoSSL is cPanel’s automatic certificate service. Until it runs for the account, the new server may answer with a self-signed certificate, which fails Full (strict) with a 526. Point DNS at the new server first, because AutoSSL must validate the domain. Then start a check in WHM under SSL/TLS → Manage AutoSSL → Manage Users. You can also run
/usr/local/cpanel/bin/autossl_check --user=<username>as root, replacing<username>with the cPanel account name. - The hostname has no site on the new server. An addon domain, alias or subdomain that was not restored has no certificate of its own. The server then answers with a default certificate for another name. Run the
opensslcommand above with-servernameand compare the names. - The firewall on the new server blocks Cloudflare. Allow Cloudflare’s published IP ranges on port 443. A blocked connection often shows as error 521 or 522 instead.
When this fix is wrong
Stop tuning the origin’s TLS configuration if the certificate prints cleanly with SNI and a cipher is negotiated. Intermittent 525s with a clean handshake test usually come from load, or from a device between Cloudflare and the origin. If the error you see is 526, the handshake worked. Go to the 526 section above.
Common mistakes
- Switching the zone to Flexible to make the 525 go away. The error disappears because Cloudflare stops using TLS to the origin, so that traffic is now unencrypted.
- Testing with
openssl s_clientwithout-servername. Without SNI, you often test a different site than the one Cloudflare requests. - Renewing the certificate but never reloading the web server. The running process keeps serving the old certificate.
- Installing a certificate for
example.comonly, when the proxied hostname iswww.example.comand the SAN list does not cover it.
Prevention
- Monitor the origin’s certificate and handshake directly, by IP address with SNI. Keep that check separate from the one that goes through Cloudflare.
- Automate renewals, include the web server reload, and alert when a reload fails.
- Consider Cloudflare Origin CA certificates for origins that only receive proxied traffic. You choose the validity period when you create one. Browsers do not trust these certificates, so they only suit proxied hostnames.
- Keep TLS 1.2 and TLS 1.3 enabled with a standard cipher list on every origin.
- After any SSL/TLS mode change or server move, run the
openssl s_clienttest as part of the change.
A 525 comes down to one question: what did the origin do wrong during the handshake? The commands above usually answer it. If the error keeps coming back, the problem usually sits between Cloudflare and the origin — Stack Harbor operates that whole path under Managed Cloud Ops, and you can book an infrastructure review.