Cloudflare Error 525: Test the Origin, Fix Nginx
Fix Cloudflare error 525: what it means
With the SSL/TLS mode set to Full or Full (strict), Cloudflare opens its own HTTPS connection to your origin. Error 525 is returned when that connection starts but the handshake fails. This is different from 526, where the handshake works but the certificate is rejected as invalid, and from 521, where nothing answers at all.
Test the origin directly
Skip Cloudflare and talk to the origin yourself. Replace the IP and hostname with your own:
openssl s_client -connect 203.0.113.10:443 -servername example.com < /dev/null
If the output ends with a certificate and "Verify return code", the origin can complete a handshake. If you see "handshake failure", "no peer certificate available" or a connection error, the problem is on your server. You can also run the SSL Checker against the public hostname to see the certificate and protocol details.
Fix Cloudflare error 525: causes and fixes
| Cause | How to spot it | Fix |
|---|---|---|
| No SSL vhost on port 443 | Connection refused or no certificate returned | Add a listen 443 ssl server block (Nginx) or a VirtualHost *:443 (Apache) |
| Port 443 blocked | Timeout from outside, works locally | Open 443 in the firewall and cloud security group |
| SNI not handled | Wrong or default certificate returned | Make sure the vhost has the right server_name / ServerName |
| Old protocols or ciphers only | Handshake failure in the OpenSSL test | Enable TLS 1.2 and a modern cipher list |
| Certificate missing or broken | Server logs show key or certificate errors | Reinstall a matching certificate and key |
Ready-to-use Nginx server block
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /etc/ssl/example.com/fullchain.pem;
ssl_certificate_key /etc/ssl/example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
}
Run nginx -t and reload. On Apache, enable mod_ssl and point SSLCertificateFile, SSLCertificateKeyFile and SSLCertificateChainFile (or the combined chain) at the right files.
A free certificate for the origin
You can issue a free Let's Encrypt certificate on TryFreeSSL.com and install it on the origin, or use a Cloudflare Origin CA certificate. An Origin CA certificate is only trusted by Cloudflare, so it works with Full (strict) as long as the orange-cloud proxy stays on. If you ever turn the proxy off, browsers will not trust it.
Quick checklist
- Run the OpenSSL test against the origin IP with
-servername. - Confirm port 443 is open from the internet.
- Confirm the vhost for this hostname has a certificate and key that match.
- Check the server error log for the exact handshake error.
- Purge nothing in Cloudflare until the origin test passes; caching does not cause 525.
Related reading: the 525 and 526 checklist and the Cloudflare SSL setup guide.
Frequently Asked Questions
Should I switch to Flexible mode to make the error go away?
No. Flexible sends traffic from Cloudflare to your origin unencrypted, so part of the path is not protected. Fix the origin instead.
Why does it work in my browser but Cloudflare shows 525?
Your browser connects to Cloudflare, not to the origin. The origin handshake is a separate connection and can fail on its own.
Is 525 different from 526?
Yes. 525 is a failed handshake. 526 means the handshake worked but the origin certificate is invalid, expired or not trusted in Full (strict) mode.
Can a firewall cause it?
Yes. A firewall or host security rule that drops Cloudflare's connections can produce handshake errors or timeouts. Allow traffic to port 443 from Cloudflare's published IP ranges.
Is error 525 ever a Cloudflare problem?
Almost never. The error is reported by Cloudflare because the origin did not complete the handshake. If the origin answers a direct openssl test from outside, look at the firewall rules that allow Cloudflare addresses.
✅ Post-Installation Verification & SEO Checklist
After applying the steps above, run through this 5-point checklist to prevent browser warnings and protect your Google SEO rankings:
- Verify full CA chain trust and TLS 1.3 support using our Live SSL Checker.
- Scan for Mixed Content HTTP links and check HSTS/CSP headers on Security Headers Checker.
- Enforce a permanent 301 HTTP-to-HTTPS redirect with our HTTPS Redirect Generator.
- Confirm both root and
wwwversions resolve cleanly to one canonical HTTPS URL. - Verify your HTTPS property and
sitemap.xmlinside Google Search Console and Bing Webmaster Tools.