Wiki / Cloudflare / Secure connection and redirects
Cloudflare Error 525 SSL handshake failed: causes and fix
Error 525 means Cloudflare connected to your server on the HTTPS port and the server did not complete the TLS handshake. It appears only in Full or Full (strict) mode. This page covers five causes: three commands separate the ones visible from outside, and the server's log confirms the rest. An expired, self-signed or wrong-name certificate alone is not one of them: in our test such a certificate served the page in Full mode.
- Urgency
- High: requests that need your server fail. If the error comes and goes, write down the times: you will need them for the logs
- Time to fix
- Each fix is one change in the web server's configuration or one setting in Cloudflare; finding the cause takes longer than fixing it
- When the fix is visible
- On the next request. In our test the answer changed as soon as the server was reconfigured; nothing has to propagate
- What you need
- The server's address (the A record in Cloudflare's DNS table), a terminal with
curlandopenssl, and access to the web server's configuration or to the hosting provider's support
What you see
- Every page shows Cloudflare's screen “SSL handshake failed, Error code 525”: Browser working, Cloudflare working, Host error.
- Scripts and monitoring get status 525 with a 16-byte body,
error code: 525, instead of that screen. - The site opens when you connect to the server directly and fails only through Cloudflare.
- It started right after a change: the encryption mode was set to Full, a new name was added to Cloudflare, the server's TLS settings or firewall were changed, or the site moved to another server.

Why it happens
In Full and Full (strict) mode Cloudflare opens its own HTTPS connection to your server for a visitor who came over HTTPS. There are two TLS handshakes: visitor to Cloudflare, and Cloudflare to your server. In the second one Cloudflare is the client: it sends the name the visitor asked for (SNI) and its own list of cipher suites, and the server has to answer. When that exchange breaks off, the visitor gets 525.
Cloudflare keeps two failures apart: the TLS exchange breaking off (525) and the server's certificate failing validation in Full (strict) mode (526, a different page). For Full mode its documentation says the server's certificate “will not be validated in any way”, and in our test an expired self-signed certificate issued to a different name served the page. So 525 is not a verdict on the certificate's validity; a certificate the server cannot load or use at all still breaks the handshake.
That is why “it works when I open the server directly” proves little. Your browser and Cloudflare offer different cipher lists, and a firewall can treat your address and Cloudflare's addresses differently. The checks below approximate Cloudflare's connection to your server.

Find the cause
Run them in order from your own computer; the third only if the second ends in TLS 1.2. Replace 192.0.2.10 with your server's address (the content of the A record in Cloudflare → DNS → Records) and example.com with the name that shows the error. If the name has several A or AAAA records, repeat for each one; an IPv6 address is written as [address]:443. Any other failure (a timeout, a refusal, a different alert) is read in the full output (the same command without | grep, or with -brief) and in the server's error log for the same second. If the server demands Cloudflare's client certificate (Authenticated Origin Pulls), a direct check without that certificate can fail although Cloudflare connects without trouble. macOS and Linux have both tools; on Windows run the commands in Git Bash, which comes with Git for Windows and includes openssl, grep and head.
curl -sI https://example.com | head -1If the answer is It means HTTP/2 525
Cloudflare reached the port and the handshake failed. Go to the next command. HTTP/2 521
Not this page. In our test this was a port with nothing listening on it: start the web server or open port 443. HTTP/2 522
Not this page. In our test the port accepted the connection and sent nothing, and Cloudflare gave up after 90 seconds: look for a firewall that drops packets or a server that is overloaded. openssl s_client -connect 192.0.2.10:443 -servername example.com </dev/null 2>&1 | grep -E "SSL routines|Cipher is"If the answer is It means 808FCEF301000000:error:0A00010B:SSL routines:tls_validate_record_header:wrong version number:ssl/record/methods/tlsany_meth.c:71: New, (NONE), Cipher is (NONE)
The port answers, but not in TLS.Cause: Port 443 answers without TLS ↓ 808FCEF301000000:error:0A000458:SSL routines:ssl3_read_bytes:tlsv1 unrecognized name:ssl/record/rec_layer_s3.c:910:SSL alert number 112 New, (NONE), Cipher is (NONE)
The server speaks TLS and refuses this name.Cause: The server rejects the name ↓ New, TLSv1.2, Cipher is ECDHE-RSA-CHACHA20-POLY1305
The handshake works from your computer on TLS 1.2. That does not clear the server yet: Cloudflare offers a shorter cipher list. Go to the next command. New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384
TLS 1.3 works from your address, and Cloudflare offered our server the same three TLS 1.3 suites, so the ciphers match. Check the key exchange requirement in the zone first. If none is set, look in the server's log for Cloudflare's failed connection: see the cause about cut connections.Cause: A key exchange requirement the server cannot meet ↓ openssl s_client -connect 192.0.2.10:443 -servername example.com -tls1_2 -cipher 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA' </dev/null 2>&1 | grep -E "SSL routines|Cipher is"If the answer is It means 808FCEF301000000:error:0A000410:SSL routines:ssl3_read_bytes:tls alert handshake failure:ssl/record/rec_layer_s3.c:910:SSL alert number 40 New, (NONE), Cipher is (NONE)
The list in the command is the TLS 1.2 part of what Cloudflare offered our server on 4 December 2026. With it the same server refuses the handshake.Cause: No cipher suite in common ↓ New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256
The server accepts this offer when it comes from your address. A direct check cannot show more: look in the server's log for Cloudflare's failed connection.Cause: The connection is cut during the handshake ↓

1. Port 443 answers without TLS
Something listens on port 443 but does not speak TLS: the site's configuration has no certificate, the listen line has no ssl parameter, or the port is forwarded to a plain HTTP service. A server that worked in Flexible mode never needed a certificate, so this cause appears when the mode is switched to Full.
How to confirm
openssl s_client -connect 192.0.2.10:443 -servername example.com </dev/null 2>&1 | grep -E "SSL routines|Cipher is"The answer when this is the cause
808FCEF301000000:error:0A00010B:SSL routines:tls_validate_record_header:wrong version number:ssl/record/methods/tlsany_meth.c:71:
New, (NONE), Cipher is (NONE)wrong version number is what OpenSSL prints when the reply is not TLS at all. On our test server nginx read Cloudflare's ClientHello as a broken HTTP request and logged client sent invalid method (log level info).
How to fix it
- Create an origin certificate: Cloudflare → SSL/TLS → Origin Server → Create Certificate. It is available on every plan, the Free plan included. Save the certificate and the private key as two files on the server; the key is shown only once.
- Add both files to the site's configuration on port 443.
- Check the configuration (
nginx -t), reload the web server and repeat the second command: it must print aCipher isline with the name of a cipher.
server {
listen 443 ssl;
server_name example.com www.example.com;
ssl_certificate /etc/ssl/example.com.pem;
ssl_certificate_key /etc/ssl/example.com.key;
}Side effects and limits. Switching the mode back to Flexible also makes the error disappear, at a price: Cloudflare then sends requests to your server unencrypted, and a server that redirects HTTP to HTTPS falls into a redirect loop. An origin certificate is meant for Cloudflare only: a visitor who reaches the server past Cloudflare gets a certificate warning, and Cloudflare sends no notice before the certificate expires.

2. The server rejects the name
The server has TLS, but not for this name: there is no HTTPS site for example.com (or for www, or for a new subdomain), and the default site refuses names it does not know. By default Cloudflare sends the name the visitor asked for, and in our log it arrived unchanged; an Origin Rule with a Host header or SNI override changes it, and then the check has to use the overridden name.
How to confirm
openssl s_client -connect 192.0.2.10:443 -servername example.com </dev/null 2>&1 | grep -E "SSL routines|Cipher is"The answer when this is the cause
808FCEF301000000:error:0A000458:SSL routines:ssl3_read_bytes:tlsv1 unrecognized name:ssl/record/rec_layer_s3.c:910:SSL alert number 112
New, (NONE), Cipher is (NONE)Alert 112 is unrecognized_name (RFC 6066): the server understood the name and has no site for it. In nginx this is a default server with ssl_reject_handshake on; its log says handshake rejected while SSL handshaking. Repeat the command with every name that goes through Cloudflare, www included.
How to fix it
- Add the name to
server_name(nginx) orServerAlias(Apache) of the site's HTTPS block. - Check that the certificate of that block covers the name. An origin certificate covers the domain and one level of subdomains by default.
- Reload the web server and repeat the command.
Side effects and limits. Do not remove ssl_reject_handshake from the default site just to silence the error: unknown names would then be answered with the first site's certificate and content.

3. No cipher suite in common
The server's cipher list was narrowed (a hardening guide, a compliance template, an old system), and nothing that is left is on Cloudflare's list. That list is shorter than a browser's: the ClientHello we logged carried nine TLS 1.2 suites and 3DES, none with ChaCha20 and none with DHE key exchange (Cloudflare's published table lists ECDHE-RSA-AES256-SHA384 where our log has AES256-GCM-SHA384). Our test server, limited to one ChaCha20 suite, passed a direct check and failed behind Cloudflare.
How to confirm
openssl s_client -connect 192.0.2.10:443 -servername example.com -tls1_2 -cipher 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA:AES256-SHA' </dev/null 2>&1 | grep -E "SSL routines|Cipher is"The answer when this is the cause
808FCEF301000000:error:0A000410:SSL routines:ssl3_read_bytes:tls alert handshake failure:ssl/record/rec_layer_s3.c:910:SSL alert number 40
New, (NONE), Cipher is (NONE)Alert 40 is handshake_failure: no acceptable set of parameters (RFC 9846). The alert alone does not name the cipher list as the reason; signature algorithms and key exchange groups end in the same alert. In our test two things pointed to ciphers: one command earlier the same server completed the handshake with OpenSSL's default list, and nginx logged SSL_do_handshake() failed (… no shared cipher) at level info.
How to fix it
- Put at least one suite from Cloudflare's list back. For a certificate with an RSA key that is
ECDHE-RSA-AES128-GCM-SHA256orECDHE-RSA-AES256-GCM-SHA384; for an ECDSA key, theECDHE-ECDSApair. - Or enable TLS 1.3: Cloudflare offered all three TLS 1.3 suites, and our server limited to TLS 1.3 answered 200.
- Check the configuration (
nginx -t), reload the web server and repeat the third command. If you chose TLS 1.3 only, repeat the second one instead: the third forces TLS 1.2.
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;Side effects and limits. Cloudflare's documentation shows a longer block that also enables TLS 1.0, TLS 1.1 and 3DES. None of them is needed to repair 525: the block above leaves them out. If old clients connect to the server past Cloudflare, check what they support before you narrow the list.


0x000a is 3DES, 0x11ec is X25519MLKEM768; nginx prints codes it has no name for as numbers.4. The connection is cut during the handshake
The port accepts the connection and then closes or resets it before the handshake ends. Possible sources are a firewall, fail2ban or a connection limit that takes Cloudflare's addresses for one aggressive client (all your visitors arrive from them), and a server that has run out of workers. For 525 errors that come and go, Cloudflare's own advice is to look in the server's logs for connections reset during the handshake.
How to confirm
curl -s -o /dev/null -w "http=%{http_code} time=%{time_total}\n" https://example.com/The answer when this is the cause
http=525 time=0.117090In our test a listener that reset the connection, and one that read the ClientHello and closed, both produced 525 in about 0.12 seconds. The time alone decides nothing (the other causes were just as fast). This cause is confirmed by the logs: a blocked or reset connection from a Cloudflare address at the second of the error.
How to fix it
- Note the time and the Ray ID from the error page and read that minute in the web server's error log, the firewall log and fail2ban's log.
- Remove the rule or ban that hit an address from Cloudflare's ranges (
cloudflare.com/ips), and add the ranges to the firewall's allow list and to fail2ban'signoreip. - Keep request limits, but make them count visitors: restore the visitor's address from the
CF-Connecting-IPheader (nginx:set_real_ip_fromwith Cloudflare's ranges andreal_ip_header CF-Connecting-IP). - In nginx, raise the log level to
infowhile you test: at the default level the handshake errors we saw are not written.
error_log /var/log/nginx/error.log info;Side effects and limits. Level info makes the log grow much faster. Set the previous level back when you are done.
5. A key exchange requirement the server cannot meet
In SSL/TLS → Overview → Origin connection & post-quantum encryption a compliance requirement is selected. With “Post-quantum hybrid” Cloudflare offers only X25519MLKEM768 on TLS 1.3; with “FIPS”, only FIPS-approved curves. A server that does not support the key exchange of the selected requirement fails the handshake. We did not reproduce this cause: it is described in Cloudflare's documentation, and the check below only shows that a stock server does not accept the post-quantum group.
How to confirm
openssl s_client -connect 192.0.2.10:443 -servername example.com -tls1_3 -groups X25519MLKEM768 </dev/null 2>&1 | grep -E "SSL routines|Cipher is"The answer when this is the cause
808FCEF301000000:error:0A000410:SSL routines:ssl3_read_bytes:tls alert handshake failure:ssl/record/rec_layer_s3.c:910:SSL alert number 40
New, (NONE), Cipher is (NONE)Our own server (nginx 1.26.3 with OpenSSL 3.0.13) refuses a client that offers only the post-quantum group; with the default groups it agrees on X25519. For FIPS, -groups P-256 tests one approved curve only; a failure with it does not rule out the others. The command needs OpenSSL 3.5 or newer on your computer.
How to fix it
- Open SSL/TLS → Overview → Origin connection & post-quantum encryption.
- Clear the compliance requirement unless a regulation obliges you to keep it. With nothing selected, Cloudflare negotiates a key exchange both sides support.
- If the requirement has to stay, the server needs a TLS library that supports it; for
X25519MLKEM768that is OpenSSL 3.5 or newer.
Side effects and limits. The requirement also applies to requests that Workers in the same zone send to other services.
What Cloudflare answered to ten states of the server
One proxied name in Full mode, ten configurations of the server behind it, 4 December 2026. Five of them end in 525 and five do not.
| What the server did | Cloudflare's answer | Time |
|---|---|---|
| Port answers in plain HTTP, no TLS | 525 | 0.18 s |
| TLS 1.2 only, one ChaCha20 cipher suite | 525 | 0.13 s |
Default site refuses the name (ssl_reject_handshake on) | 525 | 0.14 s |
| Accepts the connection and resets it at once | 525 | 0.12 s |
| Reads the ClientHello and closes the connection | 525 | 0.12 s |
| Self-signed certificate, expired, issued to another name | 200, the page is served | 0.15 s |
| TLS 1.3 only | 200 | 0.13 s |
Requires a client certificate (ssl_verify_client on) | 400 from the server: “No required SSL certificate was sent” | 0.15 s |
| No service is listening on the port | 521 | 0.10 s |
| Accepts the connection and stays silent | 522 | 90.08 s |
Our data
16.5 %
of .lt hosts that resolve answer from Cloudflare's network
17,886 of 108,195 hosts in the snapshot of 26 November 2026. For these sites a broken TLS setup on the server is reported by Cloudflare, with a 525 or 526 page, and not by the visitor's browser. The dataset records the network a host answers from, not the status code it returned, so it does not say how many of them showed 525. Dataset: Security posture of .lt websites, 26 November 2026 (CC BY 4.0)
Check that it works
Ask through Cloudflare again.
curl -sI https://example.com | head -1Expected
HTTP/2 200Ask for a page that Cloudflare neither caches nor redirects by its own rules; the matching line in the server's access log is the proof that the request arrived. Full mode accepts any certificate, so it cannot tell your server from someone else's. Before you switch to Full (strict), check the certificate on every server of the zone: not expired, issued by a public authority or by Cloudflare's Origin CA, and covering the name. Otherwise 525 is replaced by 526.
Where it comes from and what it leads to
Where it comes from
- The encryption mode was switched from Flexible to Full on a server that never had a certificate.
- A name was added to Cloudflare (
www, a subdomain) that has no HTTPS site on the server. - TLS settings were tightened on the server, or a firewall, fail2ban or rate limit was installed, without Cloudflare in mind.
- A key exchange compliance requirement was switched on in the zone.
What it leads to
- TLS certificate: the certificate expired N days ago or is valid for N more daysAn expired certificate on the server: error 526 in Full (strict) mode, no error at all in Full
- Error 521: the server refuses Cloudflare's connection
- Error 522: Cloudflare times out while connecting, or waits 90 seconds for data after the connection is made
What to write to the hosting provider
No access to the server's configuration? Send this to the hosting provider.
Hello,
example.com is behind Cloudflare in Full mode, and since [date, time, time zone] visitors get error 525 (SSL handshake failed). Ray ID from the error page: [Ray ID].
Please check on the server that hosts the site:
1. that port 443 serves this name over TLS and a certificate is installed (I can supply a Cloudflare origin certificate);
2. that the default site does not reject this name (SNI);
3. that the TLS settings include ECDHE-RSA-AES128-GCM-SHA256 or ECDHE-RSA-AES256-GCM-SHA384, or TLS 1.3;
4. that the firewall or fail2ban did not block or reset connections from Cloudflare's address ranges (https://www.cloudflare.com/ips/) at that time;
5. what the web server's error log shows at the time above.
Thank you.Sources
- Cloudflare Docs: Error 525 (the two conditions, the list of causes, compliance requirements)
- Cloudflare Docs: Full mode (the origin certificate is not validated)
- Cloudflare Docs: Full (strict) mode (what the certificate must satisfy)
- Cloudflare Docs: Error 526
- Cloudflare Docs: Cipher suites presented to origin servers
- Cloudflare Docs: Origin CA certificates
- Cloudflare Docs: Automatic key exchange to origins
- Cloudflare Docs: Flexible mode (plain HTTP to the server, redirect loops)
- Cloudflare Docs: Error 521
- Cloudflare Docs: Error 522 (the 90-second limit)
- RFC 6066, section 3: Server Name Indication, alert unrecognized_name (112)
- RFC 9846 (TLS 1.3, replaced RFC 8446 in July 2026), section 6.2: alert handshake_failure (40)
- nginx documentation: ssl_reject_handshake
- Cloudflare: IP ranges
- Cloudflare Docs: Origin Rules (Host header and SNI override)
How we tested
Tests were run on 4 December 2026: a second nginx 1.26.3 process (OpenSSL 3.0.13) on our own server, behind a temporary proxied name in a live Cloudflare zone (Free plan, Full mode). The name, the configuration and the processes were deleted afterwards. The name is shown as example.com, the server as 192.0.2.10 and the test ports (2053, 2083, 2087, 2096) as 443; Cloudflare's addresses and every reply are unchanged. Each state was requested through Cloudflare once. Direct checks used OpenSSL 4.1.0 on macOS. Two things were not reproduced and come from Cloudflare's documentation: error 526 in Full (strict) mode and a key exchange compliance requirement switched on in the zone. Apache was not tested.
