Most SSL and TLS handshake failures resolve once you reproduce the handshake with openssl s_client and check five things: an incomplete certificate chain, a missing SNI value, a protocol or cipher mismatch, an expired or wrong certificate, or a blocked port and connection reset. Run the handshake manually first, isolate which stage fails, then apply the fix that matches the error.
TL;DR:
- Most handshake failures are caused by incomplete certificate chains, protocol mismatches, or blocked ports, which can be diagnosed with particular OpenSSL commands.
- Reproducing the handshake with OpenSSL and packet captures helps identify issues like missing intermediates or SNI misconfigurations before applying fixes.
- Confirm that the server offers supported cipher suites and protocols, with special attention to TLS 1.2 and 1.3 compatibility during migrations.
- Validating the certificate's validity period and proper hostname match is crucial, and rotating certificates is necessary if they are expired or issued incorrectly.
- After fixing, always verify across multiple clients and networks, using monitoring tools that check certificate validity and connection health continuously.
Table of Contents
- Reproduce the failure and collect diagnostics
- Root causes mapped to concrete fixes
- Reading openssl sclient output correctly
- Verifying the fix and setting up monitoring
- Operator perspective: what actually slows down incident response
- Checking and monitoring SSL with Pingfloat
- Reference documentation for further troubleshooting
- Sources
- FAQ
Reproduce the failure and collect diagnostics
Before touching any configuration, capture what is actually happening on the wire. A fix applied without diagnostics often masks the real problem or breaks something else.
- Run
openssl s_client -connect host:443 -servername host -showcertsto reproduce the handshake and print the full certificate chain sent by the server. - Run
curl -v --tlsv1.2 https://hostto see the handshake from an HTTP client's perspective, including which certificate curl trusted or rejected. - Capture packets with
tcpdump -i any port 443 -w handshake.pcapwhile reproducing the error, then open the file in Wireshark and filter ontls.handshaketo see the ClientHello and ServerHello exchange.
Check the timestamps in the pcap against your server logs. On nginx or Apache with mod_ssl, look for SSL alert lines in the error log; on an application server, check for exceptions thrown during the TLS layer rather than the HTTP layer. If you are behind a CDN, pull the CDN's edge logs and the origin's access logs for the same window, since the failure may be occurring only on one leg of the connection.
Isolate variables one at a time: test from a different network to rule out a local firewall or proxy, test the origin IP directly instead of through the CDN, and run the same command with and without -servername to see if the server behaves differently without SNI.

Root causes mapped to concrete fixes
Once you have a pcap and an s_client transcript, most failures fall into one of six buckets.
- Cipher or protocol mismatch: list what the server offers with
openssl ciphers -vor a scanner like SSLyze, then compare against what the client supports. If you are mid-migration to TLS 1.3, temporarily allow TLS 1.2 alongside it withssl_protocols TLSv1.2 TLSv1.3;on nginx so legacy clients are not locked out while you upgrade them. - Incomplete certificate chain: build a proper
fullchain.crtby concatenating the leaf certificate and intermediate certificates in order (cat leaf.crt intermediate.crt > fullchain.crt), then confirm it withopenssl verify -CAfile chain.pem fullchain.crt. - Missing SNI or hostname mismatch: reproduce with and without
-servernamein s_client; if the server returns a different or default certificate without it, your virtual host configuration needs an explicit SNI mapping. - Expired or incorrect certificate: check
notBeforeandnotAfterin the s_client output, and for Java applications inspect the truststore withkeytool -list -v -keystore truststore.jks. Rotate the certificate if it is expired or was issued for the wrong hostname. - Network, port, or CDN origin errors: confirm port 443 is open with
nc -zv host 443, check firewall and reverse proxy logs for resets, and if you are seeing Error 525 on Cloudflare, verify the origin has a valid certificate installed, port 443 open, and cipher suites compatible with Cloudflare's edge. - Clock skew: certificate validation depends on system time, so check it with
timedatectl statuson Linux orw32tm /query /statuson Windows, and sync with NTP if the drift is more than a few seconds.
Pro Tip: Keep a copy of the failing s_client transcript before you change anything, since some fixes (especially cipher policy changes) are hard to reverse cleanly once other services depend on the new configuration.
Reading openssl s_client output correctly
The s_client transcript tells you exactly which handshake stage failed, so read it in order rather than jumping to the certificate section first.
- Check the Protocol line first: if it shows a version you didn't expect, force one with
-tls1_2or-tls1_3to confirm which versions the server actually supports. - Check Cipher: an empty or unexpected value usually means no cipher overlap, which you can confirm by adding
-cipherwith a specific suite to test compatibility directly. - Check the Verify return code: anything other than
0 (ok)points to a certificate problem, and adding-verify_return_errorwill make s_client abort on that error instead of continuing past it for inspection. - Count the certificates under
Certificate chain: a chain of length one when the server should be sending intermediates is the signature of a missing chain file.
A chain of only one certificate where you expect two or three is one of the most reliable signs of a missing intermediate, and TLS handshake troubleshooting guidance notes that browsers often mask this by fetching missing intermediates automatically, which is why a site can look fine in Chrome while failing in curl or a Python client.
Verifying the fix and setting up monitoring
Once you have applied a fix, confirm it holds across more than one client before calling the incident closed.
- Re-run the same
openssl s_clientandcurl -vcommands you used to reproduce the failure, plus a test from an actual browser and from any application runtime (Python, Java, Node) that talks to the endpoint. - Test from an external vantage point, not just your own network, since a fix that works locally can still fail from other regions if a CDN edge or firewall rule is inconsistent.
- Capture a fresh pcap during the retest to confirm the handshake completes cleanly, with a
Verify return code: 0 (ok)and the expected certificate chain length. - Set up an ongoing HTTPS check that alerts on verification failures or certificate fingerprint changes, not just on whether the port responds.
Operator perspective: what actually slows down incident response
The biggest mistake in handshake incidents is changing server-wide cipher or protocol policy before you have captured a clean reproduction of the failure. Once you have changed the configuration, you lose the evidence that would have told you the actual root cause, and you risk introducing a second problem on top of the first.
The second mistake is trusting a browser test. Browsers auto-fetch missing intermediates, so a chain that looks complete in Chrome can still break every non-browser client hitting the same endpoint. During an incident, prioritize the fix that restores the most clients fastest, usually adding the missing intermediate or correcting SNI, and save cipher policy hardening for a scheduled maintenance window after the fire is out.
— Andreas
Checking and monitoring SSL with Pingfloat
Once the handshake is fixed, you still need a fast way to confirm the chain is correct and catch the next expiry before it becomes an outage. The Pingfloat SSL Checker inspects a live certificate chain and flags expiry and common installation mistakes in seconds, with no install and no account required.

Pair that with the Website Uptime Monitor to keep watching the endpoint after the fix ships, so a renewed certificate or a config rollback that reintroduces the same handshake error gets caught before a customer reports it. Both tools run directly in the browser, which makes them a practical addition to a reproduce and verify workflow without adding another dependency to your stack.
Reference documentation for further troubleshooting
- s_client - OpenSSL Documentation: command reference for the diagnostic tool used throughout this guide.
- Transport Layer Security - MDN Web Docs: handshake stages and SNI explained.
- Error 525 · Cloudflare Support docs: origin handshake failure causes.
- Diagnosing TLS/SSL handshake failures - Apigee docs: cause and remediation tables.
Sources
FAQ
How can I fix an SSL handshake error?
Reproduce the failure with openssl s_client -connect host:443 -servername host -showcerts, then check the certificate chain length, the negotiated protocol and cipher, and the verify return code in the output. Most fixes involve adding missing intermediate certificates, correcting SNI configuration, enabling a compatible protocol version, renewing an expired certificate, or opening a blocked port.
My iPhone is saying "SSL handshake failed." How can I fix this?
This usually means the device's clock is wrong, the network is intercepting the connection, or the server's certificate chain is incomplete for non-browser style clients. Check the device's date and time settings first, then try the same site on a different network to rule out a captive portal or firewall issue.
What does SSL handshake mean?
The SSL or TLS handshake is the negotiation a client and server perform before any data is exchanged: they agree on a protocol version and cipher suite, the server presents its certificate chain, and the client verifies it before encrypted communication begins, as MDN's TLS documentation describes. If any step fails, the connection is dropped before any application data is sent.
What does the "SSL handshake failed error 525" mean and how can I fix it?
Error 525 is specific to Cloudflare and means the handshake between Cloudflare's edge and your origin server failed, according to Cloudflare's own documentation. Check that your origin has a valid certificate installed, that port 443 is open and not blocked by a firewall, and that the origin supports SNI and a cipher suite compatible with Cloudflare's edge.
