Cloudflare Error 525 (SSL Handshake Failed): Causes and a Tested Fix
Error 525 (SSL handshake failed) means Cloudflare reached your origin server (the real server behind Cloudflare) on the HTTPS port, but the two could not agree on an encrypted connection. Cloudflare only shows it when your SSL/TLS mode is Full or Full (strict), because in those modes it talks to your server over HTTPS. The visitor’s browser and Cloudflare are fine; the TLS setup on the server is not.
If you only see error code 525 on someone else’s website, the problem is on their server, not your device. If it is your site, below I show how I caused error 525 on a test server with a one-word change to Nginx, how fast Cloudflare failed, and the checks that find and fix the real cause.
Tested by Dolon Bepari, 20 November 2026
- Server: a throwaway Ubuntu 22.04 VPS (1 vCPU, about 2 GB RAM), aaPanel 7, Nginx 1.30.7, PHP 8.4, WordPress
- Cloudflare: Free plan, orange cloud (proxied), test domain filecafe.site; test file: a small text file
- How I measured: curl and a browser from my PC in Dhaka, Bangladesh, through Cloudflare, plus curl on the server itself
- There are no affiliate links in this guide. How I test: how we review
Table of Contents
What error code 525 means
Error 525 is often called HTTP error 525, but it is a Cloudflare status code, not a standard HTTP one. The browser page says SSL handshake failed, so “ssl handshake failed error code 525”, “error code 525” and “Cloudflare error 525” are the same problem. The handshake is the first few messages of every HTTPS connection: the server presents its certificate, both sides pick an encryption method, and only then does the real request go through.
Cloudflare’s error 525 page (last updated 16 June 2026, checked 21 November 2026) says it happens only when both are true: the SSL handshake between Cloudflare and the origin fails, and the SSL/TLS mode is Full or Full (strict). In Flexible mode Cloudflare connects to your server over plain HTTP, so there is no handshake to fail.

The red Host box points at your server, but the server is up and answering. With error 521 the server refuses the connection. With 525 the connection opens, but the TLS part fails. With error 526 the handshake works, but Cloudflare rejects the certificate in Full (strict).
Is error 525 your fault? Visitor vs site owner
If you are a visitor, it is not your fault. Nothing is wrong with your device, browser or connection, and clearing your cache or changing your clock will not fix it, because the failing connection is between Cloudflare and the website’s server. Wait a few minutes, try again, and if it continues, tell the site owner and include the Ray ID, the short reference code Cloudflare prints at the bottom of the error page.
If you own the site, it needs fixing now. Every request that hits a 525 fails, so the page or the whole site is down for visitors. The fix is on your server: make port 443 speak TLS with a valid certificate, or correct the TLS settings that Cloudflare cannot use. Do not switch Cloudflare to Flexible as the fix; I explain why below.
How I reproduced error 525 (and what I measured)
None of the top-ranking guides I read caused a 525 and showed what it looks like from both sides. I did, on a throwaway VPS that I deleted afterwards, running WordPress on a test domain proxied through Cloudflare’s Free plan. I reproduced one cause: port 443 answering without TLS.

The change: one word in the Nginx config
The site’s Nginx config had listen 443 ssl; and listen 443 quic;. I made a backup, removed the word ssl from the first line, tested the config and reloaded Nginx. The certificate lines stayed in the file, so the certificate was still on the server. Nginx simply stopped speaking TLS on port 443 and answered there in plain HTTP instead.
▶ What I ran on the test server, as root (this breaks HTTPS on purpose; do not run it on a live site). The last line is the local HTTPS test:
cp /www/server/panel/vhost/nginx/filecafe.site.conf /root/cflab-vhost.bak
sed -i 's/listen 443 ssl/listen 443/' /www/server/panel/vhost/nginx/filecafe.site.conf
grep -n "listen" /www/server/panel/vhost/nginx/filecafe.site.conf
/www/server/nginx/sbin/nginx -t && /www/server/nginx/sbin/nginx -s reload
sleep 2; curl -sSk -o /dev/null --resolve filecafe.site:443:127.0.0.1 https://filecafe.site/cf-lab.txt
The config test passed, so Nginx saw nothing wrong. But an HTTPS request on the server itself failed with curl error 35, wrong version number. That is what a TLS client reports when the other side answers in plain HTTP instead of starting a handshake.

What Cloudflare showed: 525 in under a second
Through Cloudflare, the browser showed the 525 page above. In a second run later in the session, with the same change in place, I requested the file three times from my PC. All three came back as 525, in 0.233586, 0.830952 and 0.230065 seconds. Like 521 and 520, a 525 fails fast. There is no long wait as with 522 or 524.

What this test does and does not show
It shows that a server can pass nginx -t, keep a certificate on disk and still cause a 525. The listen 443 quic; line, which is for HTTP/3 over UDP, was still there, and the result was still 525. After each run I put the backup config back. Earlier in the same session I had used Full (strict) for my error 526 test, but I did not screenshot the SSL/TLS page during this test, so I only claim what 525 requires: Full or Full (strict). I did not test the SNI or cipher causes below.
What causes error 525
Cloudflare’s 525 documentation lists four common causes to rule out with your host. I reproduced a version of the first; the others are Cloudflare’s descriptions, not my tests.
- No valid TLS setup on port 443. Cloudflare’s wording is “no valid SSL certificate installed on the origin”. In my lab the certificate existed, but Nginx was not using TLS on 443, which has the same effect. Other versions: a site that was never given HTTPS, or a panel that rewrote the config.
- Port 443 is not open. Cloudflare lists it, but in my lab, when nothing at all listened on 443, Cloudflare returned 521 (connection refused), not 525. So a 525 usually means something answered on 443 but could not complete TLS.
- The origin does not support SNI. SNI (Server Name Indication) is how Cloudflare tells your server which hostname it wants, so the server can pick the right certificate. Not tested.
- No common cipher suite. If your server only allows ciphers or TLS versions that Cloudflare does not use, the handshake fails. This often follows aggressive “hardening”. Not tested.
If the 525 comes and goes, Cloudflare suggests checking the origin’s error log at the exact times of the errors for something resetting connections during the handshake, such as a firewall or security tool. That is also not part of my test.
How to fix error 525 on Nginx and aaPanel, step by step
Every command below says where to run it and what it does. Only the ones marked “changes” modify anything. Replace example.com with your domain. The paths are aaPanel’s; on a standard Nginx install the site config is usually in /etc/nginx/sites-enabled/ or /etc/nginx/conf.d/, the binary is just nginx, and the error log is /var/log/nginx/error.log.
Step 1: Confirm the 525 and how fast it fails
▶ On your own computer, in Windows cmd (not PowerShell). On Mac or Linux, use curl instead of curl.exe, /dev/null instead of NUL, and ; instead of & between the three commands:
curl.exe -sS -o NUL -w "%{http_code} %{time_total}\n" https://example.com/ & curl.exe -sS -o NUL -w "%{http_code} %{time_total}\n" https://example.com/ & curl.exe -sS -o NUL -w "%{http_code} %{time_total}\n" https://example.com/
What it does: requests your homepage through Cloudflare three times and prints the status code and total time for each (-S makes curl still show an error if one happens). It changes nothing. A 525 is a handshake failure whatever the time; mine took 0.23 to 0.83 seconds. A 526 is a certificate that Cloudflare rejects, and a 521 is a refused connection; each has its own guide.
Step 2: Test HTTPS on the origin, skipping Cloudflare
▶ On the server (SSH terminal):
curl -sSk -o /dev/null -w "%{http_code}\n" --resolve example.com:443:127.0.0.1 https://example.com/
What it does: makes an HTTPS request for your domain to the web server on this machine, skipping DNS and Cloudflare, and prints the status code. It changes nothing. -k skips the certificate check, because this step only tests whether a handshake happens at all; a self-signed or Origin CA certificate would otherwise fail here even though Cloudflare can use it.
- curl error 35, wrong version number: port 443 answers in plain HTTP. This was my lab. Go to step 3.
- Another curl error 35 (for example a handshake failure or an alert): TLS is on, but the server rejects the handshake. Check steps 5 to 7.
- curl error 7, Connection refused: nothing listens on 443; that is normally a 521, see my error 521 guide.
- A status code such as 200 or 301: the handshake works locally. Go to step 5 (SNI and the hostname), step 6 (ciphers) and step 7 (logs and firewalls).
Step 3: Check the HTTPS lines in the site’s Nginx config
▶ On the server (SSH terminal), as root or with sudo; aaPanel path:
grep -nE "listen|ssl_certificate" /www/server/panel/vhost/nginx/example.com.conf
What it does: prints the listen lines and the certificate lines of your site’s config, with line numbers. It changes nothing. For a normal HTTPS site you want listen 443 ssl; (older configs may show listen 443 ssl http2;), a matching listen [::]:443 ssl; line if the site uses IPv6, plus ssl_certificate and ssl_certificate_key. A listen 443; line without ssl is exactly what caused my 525. A listen 443 quic; line without ssl is normal; that one is for HTTP/3. No certificate lines at all means the site has no HTTPS yet: go to step 4.
Step 4: Fix the config (or add a certificate) and reload
If you have a backup from before the change, restoring it is the cleanest fix. This is what I did in my lab:
▶ On the server (SSH terminal), aaPanel only, as root or with sudo (changes the site’s Nginx config and reloads Nginx; use your own backup path):
cp /root/example.com.conf.bak /www/server/panel/vhost/nginx/example.com.conf && /www/server/nginx/sbin/nginx -t && /www/server/nginx/sbin/nginx -s reload
What it does: puts the backup config back, tests it and reloads Nginx only if the test passes. Without a backup, open the file in an editor (for example nano), add ssl to the TCP 443 listen lines (listen 443 ssl;, listen [::]:443 ssl;), leave any listen 443 quic; line as it is, save, and run the same nginx -t and reload commands. If nginx -t reports an error, fix that first.
If the site has no certificate at all, add one. Behind Cloudflare, a free Cloudflare Origin CA certificate works in Full (strict); my error 526 guide shows that test. Creating one and installing it on aaPanel is covered in my Origin CA certificate guide. A Let’s Encrypt certificate also works, and aaPanel’s site SSL settings can issue one. I did not test the Let’s Encrypt route in this lab. Then run step 2 again: you should see a status code instead of an error.
Step 5: Check the certificate the server sends, with and without SNI
▶ On the server (SSH terminal):
openssl s_client -connect 127.0.0.1:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates
What it does: starts a TLS handshake with the server, asks for your hostname by SNI, and prints the subject, issuer and dates of the certificate it gets. It changes nothing. You want your domain in the subject (or a wildcard that covers it) and dates that include today. If it prints nothing or an error, there is no working TLS for that hostname.
To see what a client without SNI gets, run the same command with -noservername in place of -servername example.com (OpenSSL 1.1.1 or newer). It also changes nothing. If that returns a different site’s certificate, or nothing, your server depends on SNI for this site. Cloudflare does send SNI, but an origin that ignores SNI serves its default certificate to Cloudflare too, so a wrong default site shows up here. I did not run these two commands in my lab.
Step 6: Look for cipher or TLS version limits
▶ On the server (SSH terminal), as root or with sudo:
grep -rnE "ssl_protocols|ssl_ciphers" /www/server/panel/vhost/nginx/ /www/server/nginx/conf/nginx.conf
What it does: shows any line that limits TLS versions or ciphers in the site configs and the main Nginx config. It changes nothing. Allowing TLS 1.2 and TLS 1.3 with a common modern cipher list is the safe choice. If someone narrowed these lines to a short or unusual list, compare it with Cloudflare’s list of supported origin cipher suites before changing anything. Not tested in my lab.
Step 7: Read the error log at the time of the 525
▶ On the server (SSH terminal), as root or with sudo; aaPanel log path:
tail -n 50 /www/wwwlogs/example.com.error.log
What it does: shows the last 50 lines of the site’s Nginx error log. It changes nothing. Look for SSL or handshake messages at the times of the 525s. Cloudflare notes that Nginx writes SSL errors to the normal error log, but you may need to raise the log level (for example to info) to see handshake details; that change needs a reload and makes the log grow, so lower it again afterwards. If a firewall or security tool resets connections, its own log is the place to check. Not tested in my lab.
Step 8: Check that it is fixed
Run the three requests from step 1 again. You should get 200 (or a normal redirect) instead of 525. If you now get 526, the handshake works but Cloudflare rejects the certificate in Full (strict); follow my error 526 guide.
On shared hosting
On shared hosting you usually cannot edit Nginx. Ask your host to check, for your domain, that HTTPS works on port 443 with a valid certificate and that SNI and Cloudflare’s ciphers are supported, and send them the Ray ID and time of the 525. If your host cannot help, a small VPS gives you full control; I tested Vultr, Hetzner and DigitalOcean with real numbers.
Should you switch to Flexible SSL to fix error 525?
No, not as a fix. Some top-ranking guides suggest Flexible as a first step, and it does make the 525 page disappear, because in Flexible mode Cloudflare connects to your server over plain HTTP on port 80 and never attempts a handshake. But the traffic between Cloudflare and your server is then unencrypted, and the broken HTTPS on your server is still broken.
Flexible can also cause a redirect loop. In the same lab, in a separate test, Flexible combined with an HTTPS redirect on the server gave ERR_TOO_MANY_REDIRECTS. My too many redirects guide shows that loop and the fix. You do not need Flexible to confirm the cause: the step 2 curl tests the origin’s TLS directly without touching Cloudflare. My Cloudflare settings for WordPress guide explains the mode I use.
Error 525 vs 526, 521, 520, 522 and 524
All of these came from the same test server, through the same Cloudflare zone. How long each one takes to fail is a quick clue.
| Error | What happened | Time to fail in my tests | Guide |
|---|---|---|---|
| 525 SSL handshake failed | Connected on 443, but the TLS handshake failed (plain HTTP on 443) | 0.23 to 0.83 s | This page |
| 526 Invalid SSL certificate | Handshake worked, but Full (strict) rejected the self-signed certificate | 0.27 to 1.25 s | Error 526 |
| 521 Web server is down | The server refused the connection | 0.20 to 0.26 s | Error 521 |
| 520 Unknown error | The server closed the connection without an answer | 0.20 to 0.27 s | Error 520 |
| 522 Connection timed out | The connection never opened (packets dropped) | 19.39 to 19.75 s | Error 522 |
| 524 A timeout occurred | Connected, but no answer within 125 seconds | 125.29 s | Error 524 |
The short version of 525 vs 526: 525 means Cloudflare and your server could not set up TLS at all; 526 means TLS worked but the certificate failed Cloudflare’s check in Full (strict). Switching from Full (strict) to Full can stop a 526, but it does not stop a 525, because both modes need a working handshake.
Does error 525 hurt SEO?
A 525 for a few minutes is unlikely to matter. Google’s documentation says 5xx server errors make Googlebot slow down crawling, and that indexed URLs that keep returning server errors are eventually dropped from the index. A 525 usually breaks every page at once, so treat it as an outage and fix it quickly.
How to prevent error 525
- Test after every config change.
nginx -tonly checks syntax. Run the step 2 curl after you edit a site or change a panel’s SSL settings. - Back up the site’s config before editing it. It lets you undo a bad edit with one copy command, as I did after each lab run.
- Watch certificate expiry anyway. An expired certificate gives a 526 in Full (strict), not a 525, and Cloudflare does not email you before an Origin CA certificate expires.
- Do not over-harden TLS. Keep TLS 1.2 and 1.3 with a common cipher list unless you have checked Cloudflare’s supported list.
- Keep Full (strict) with a valid certificate. It is the setup that tells you about problems instead of hiding them; my Cloudflare settings for WordPress guide covers the rest.
Error 525 FAQ
How to fix SSL handshake error 525?
Test HTTPS on your server directly, skipping Cloudflare. If it fails, make port 443 use TLS with a valid certificate (in Nginx, listen 443 ssl plus the certificate lines), test the config and reload. Then check SNI, ciphers and the error log if it still fails. In my lab the cause was one missing word, ssl, on the 443 listen line.
What does the 525 HTTP error code mean?
It is Cloudflare’s code for a failed SSL handshake between Cloudflare and the website’s server. It only appears when the SSL/TLS mode is Full or Full (strict). It is not a standard HTTP status code.
What causes an SSL handshake failure?
Cloudflare lists four common causes: no valid certificate or TLS setup on the origin, port 443 not open, no SNI support, and no common cipher suite. I reproduced the first by making Nginx answer plain HTTP on port 443.
Can a visitor fix error 525?
No. The failing connection is between Cloudflare and the website’s server, so clearing the cache or changing browsers will not help. Try again later and tell the site owner, with the Ray ID from the error page.
Does switching to Flexible SSL fix error 525?
It hides it, because Flexible connects to your server over plain HTTP. The connection between Cloudflare and your server is then unencrypted, and a site that forces HTTPS can get stuck in a redirect loop. Fix HTTPS on the server and keep Full (strict).
What is the difference between error 525 and 526?
525 means the TLS handshake failed, so no encrypted connection was set up. 526 means the handshake worked but Cloudflare rejected the certificate in Full (strict). Switching to Full can stop a 526 but not a 525.
Do I need a Cloudflare Origin certificate to fix error 525?
Only if your server has no certificate. Any certificate that your server actually serves on port 443 removes the handshake failure. For Full (strict) it must be a Cloudflare Origin CA certificate or a publicly trusted one such as Let’s Encrypt.
What does error 525 mean on AO3 or another site I visit?
If the page comes from Cloudflare, that site’s server failed the TLS handshake with Cloudflare; your device and account are fine. I have not tested any specific site. Check its status page or social accounts and try again later.
How fast does error 525 appear?
Fast. In my test three requests returned 525 in 0.23, 0.83 and 0.23 seconds. A 522 or 524 takes much longer.
