Both errors come from the second half of the trip. Visitors reach Cloudflare fine; it's the HTTPS connection from Cloudflare to your own server (the origin) that fails. Which code you see tells you how far it got:
| Code | What happened | Shown when the SSL/TLS mode is |
|---|---|---|
| 525 SSL handshake failed | Cloudflare reached your server, but the HTTPS handshake never completed. | Full or Full (strict) |
| 526 Invalid SSL certificate | The handshake worked, but Cloudflare couldn't validate your server's certificate. | Full (strict) only |
Cloudflare treats both as a problem in your server's TLS setup: retrying won't help until it's fixed.
Test your server's certificate directly
To see what Cloudflare sees, connect straight to your server's IP address instead of through Cloudflare. Replace 203.0.113.10 with your origin's IP (it's in your Cloudflare DNS record):
curl -sv --resolve yourdomain.com:443:203.0.113.10 https://yourdomain.com/ -o /dev/nullIn the output, look for the certificate's subject and subjectAltName (the names it covers), expire date and issuer, and any SSL error. For the certificate on its own:
echo | openssl s_client -connect 203.0.113.10:443 -servername yourdomain.com 2>/dev/null | openssl x509 -noout -subject -issuer -enddateIf the connection is refused or hangs, nothing is listening on port 443: that's a 525. If you get a certificate back, check it against the list under 526.
Error 525: SSL handshake failed
Cloudflare's documentation lists four common causes on the origin:
- No certificate installed, so the server can't answer HTTPS at all.
- Port 443 isn't open, or the web server isn't listening on it. A firewall that only allows port 80 does this.
- No SNI support. Cloudflare sends the hostname during the handshake (SNI); a server that ignores it may answer with the wrong certificate or none.
- No cipher suites in common between Cloudflare and your server, often a very old server configuration.
The fix: install a certificate on the server and make sure it listens on 443 (see "Fixing it" below). If 525s come and go, read the web server's error log at the times they happen: Nginx records SSL errors in its normal error log (you may need a higher log level), and Apache can be set to log mod_ssl errors.
Error 526: invalid SSL certificate
In Full (strict) mode, Cloudflare checks the origin's certificate the way a browser would. It must be:
- Not expired and not revoked.
- Issued by a publicly trusted certificate authority or by Cloudflare's Origin CA, not self-signed.
- For the right name: the hostname must be in the certificate's Common Name or Subject Alternative Names. A certificate for
yourdomain.comdoesn't coverwww.yourdomain.comunless it lists both. - Served with its full chain: the server must send the intermediate certificates, not just its own.
The most common real-world cause is an origin certificate that quietly expired. Cloudflare's Automatic SSL/TLS setting won't drop you from Full (strict) to a weaker mode when that happens, so the site starts returning 526 on the day it expires.
Fixing it
Option 1: a free Cloudflare Origin CA certificate
If every visitor reaches the server through Cloudflare (the DNS record is proxied, orange cloud), Cloudflare will issue a free certificate for your origin, valid for up to 15 years:
- In the Cloudflare dashboard, go to SSL/TLS → Origin Server and select Create Certificate.
- Let Cloudflare generate the private key, keep the hostnames it lists (your domain and its wildcard), and choose the validity period.
- Copy the Origin Certificate and the Private Key into two files. You can't see the private key again after leaving the page.
- Install them on your web server, enable HTTPS on port 443, and reload it. Some servers also need Cloudflare's Origin CA root certificate as the chain.
- Set SSL/TLS encryption to Full (strict).
Two limits: browsers don't trust these certificates, so if you pause Cloudflare or set a record to DNS only (grey cloud), visitors get a certificate warning. And as of November 2026, Cloudflare doesn't send expiry reminders for Origin CA certificates, so note the date yourself.
Option 2: a publicly trusted certificate
A certificate from a public authority, such as a free Let's Encrypt certificate renewed automatically by Certbot, works with Full (strict) and keeps working if you ever turn Cloudflare's proxy off. If renewal is what failed, see how to monitor SSL certificate expiry, and note that public certificates now last 200 days at most (what changed).
Optional: only let Cloudflare reach your origin
Once HTTPS to the origin works, you can go a step further with Authenticated Origin Pulls: Cloudflare presents a client certificate on every connection to your server, and the server rejects any connection without it. Anyone who finds your origin's IP address can then no longer reach it directly, around Cloudflare. It isn't needed to fix a 525 or 526, it works only with Full or Full (strict) (not Off or Flexible), and it doesn't apply to origins connected through Cloudflare Tunnel. Setup is in Cloudflare's dashboard under SSL/TLS → Origin Server, plus a change to your web server to require the certificate.
A stopgap: Full instead of Full (strict)
Cloudflare's own suggested quick fix for a 526 is to switch the mode from Full (strict) to Full, which still encrypts but no longer checks the certificate. It gets the site back up, but treat it as temporary and go back to Full (strict) once the certificate is fixed. Full doesn't help with a 525: the handshake still has to work.
Seeing 526 from a Cloudflare Worker?
A Worker's requests to hostnames outside your Cloudflare zone always use Full (strict) checks, whatever your zone's setting. So a Worker fetching a site with an expired or self-signed certificate gets a 526 even if your own site is set to Full.
After the fix
Run the direct test from above again and check that it now shows a valid certificate and no SSL error:
curl -sv --resolve yourdomain.com:443:203.0.113.10 https://yourdomain.com/ -o /dev/nullThen load the site in a private window. Then make sure you'll hear about the next expiry before it causes an outage.