Diagnosing SSL handshake errors with Cloudflare and server logs

A Cloudflare 525 page means the visitor’s connection to Cloudflare succeeded, but Cloudflare could not establish TLS with the origin. The failure therefore occurs before an HTTP request reaches the application; replacing web pages will not reveal its cause. The useful evidence is the origin web server’s TLS error stream, correlated with a handshake attempt from Cloudflare’s edge.

The reliable method for checking server logs for detailed SSL handshake error messages starts with identifying the hostname, Cloudflare zone and exact time of a failed request. Then reproduce the connection directly against the origin and inspect the logs generated at that moment. This sequence distinguishes certificate, protocol, SNI and routing faults from application failures while avoiding unnecessary changes to a production site.

Understand what Cloudflare is reporting

A 525 should not be confused with a browser certificate warning or a normal 502 response. The 525 confirms that Cloudflare reached the origin’s address but could not complete the encrypted negotiation. A browser warning points towards the client-to-edge certificate path, while a 502 often means TLS succeeded and the upstream application or proxy failed later.

The main diagnostic distinctions are:

Signal What it suggests Immediate check
Cloudflare 525 Edge-to-origin TLS failed Origin TLS and proxy logs
Browser certificate warning Client rejected the edge certificate Certificate chain and hostname
Connection refused TCP listener or firewall blocked access Socket and firewall logs
Cloudflare 502 Upstream failed after encryption Application and proxy logs
TLS success with a slow response Encryption is not the immediate fault Request and application timings

If the hostname under investigation is the affected domain, record it exactly as it appears in Cloudflare and DNS, including any www prefix. The TLS server name indication, or SNI, uses that hostname; testing an IP address without preserving SNI can select a different certificate or cause an apparent handshake failure. Note whether DNS publishes IPv4, IPv6 or both.

Reproduce the handshake against the origin

Find the origin address in the Cloudflare DNS panel or hosting account, because a proxied domain normally resolves to Cloudflare edge addresses rather than the server. Record the hostname, origin IP, listener port and relevant proxy rules. If the origin accepts traffic only from Cloudflare, allow a direct diagnostic test from an approved source or use a temporary, tightly controlled access rule.

openssl s_client -connect shop.example.com.au:443 -servername shop.example.com.au </dev/null
openssl s_client -connect 203.0.113.10:443 -servername shop.example.com.au -showcerts </dev/null

Compare the edge connection with a direct origin connection. A successful edge session followed by an origin failure confirms that the fault lies in the edge-to-origin path. Common openssl messages include certificate verify failed, handshake failure, no protocols available, wrong version number and unexpected eof while reading. These point towards trust-chain, protocol, cipher or abrupt-close problems, but the surrounding server log line remains essential.

Use the first command for the public edge and the second for the origin, replacing the example values. Add -tls1_2 or -tls1_3 to isolate protocol support, and repeat with curl -4 and curl -6 when both address families are published. A refusal from the origin firewall may be expected if it admits only Cloudflare ranges; it is still evidence that the direct test did not reproduce the same route.

For an Australian hostname such as shop.com.au or shop.au, keep the full name in SNI. Local latency can be excellent when an origin runs in AWS Sydney (ap-southeast-2) or Melbourne (ap-southeast-4), yet low latency does not prove that certificate negotiation succeeds.

Read web server and certificate errors

Handshake failures often leave no HTTP access-log entry because the connection dies before a request can be parsed. Read the TLS-capable error sources instead: Nginx and Apache error logs, Caddy’s structured or debug output, the load balancer in front of the application and the system journal. Search for SSL_do_handshake, SSL handshake failed, certificate verify failed, unknown ca, no shared cipher and certificate expired.

Useful first-pass filters include grep -Ei 'SSL|handshake|certificate|cipher' /var/log/nginx/error.log and journalctl -u apache2 | grep -Ei 'SSL|handshake|certificate'. On Debian and Ubuntu, Apache commonly writes to /var/log/apache2/error.log; RHEL-based hosts often use /var/log/httpd/error_log.

Increase verbosity only for the shortest possible window. On Nginx, a temporary error_log /var/log/nginx/error.log info; directive can expose TLS details; on Apache, LogLevel warn ssl:info is a useful starting point when supported by the installed module. Caddy operators should enable debug logging through the service’s normal configuration mechanism. Restore the previous logging level afterwards because verbose SSL logs may contain client certificate subjects or other sensitive metadata.

Before putting a screenshot in a Telegram support thread, Telegram spoiler mode can conceal unrelated windows. Redact cookies, authorisation headers, query strings, customer names and unredacted certificates before any log leaves the private system.

Use sudo journalctl -u nginx --since "30 min ago" or the equivalent service and unit names for your host. Use Cloudflare’s Ray ID to correlate events that reached HTTP; for handshake-only failures, correlate the UTC timestamp and Cloudflare source address instead. Sydney and Melbourne change between AEST (UTC+10) and AEDT (UTC+11), while Western Australia remains on AWST (UTC+8), so converting timestamps first prevents a valid event from appearing in the wrong window.

Isolate network and TLS configuration faults

Certificate validation is the first branch to examine. Under Cloudflare’s Full (strict) mode, the origin certificate must be valid for the requested hostname and chain to an authority trusted by Cloudflare. Check the full chain, not only the leaf; a missing intermediate can produce unable to get local issuer certificate. Confirm the not-before and not-after dates, key type and signature algorithm, and that server time is synchronised. Cloudflare Origin CA certificates are suitable where Cloudflare is the relying client, although a local verifier may reject them because they are absent from the operating system’s trust store.

Next, inspect SNI selection, protocol versions and cipher policy. A default certificate can be returned when the server cannot match the requested name, especially on multi-site hosts. Align TLS 1.2 and TLS 1.3 settings with Cloudflare’s current compatibility requirements instead of weakening the origin indiscriminately. Run nginx -T or apachectl configtest after any configuration change, and verify that port 443 is listening with ss -ltnp.

Network policy can masquerade as a TLS problem. Allow Cloudflare’s documented IPv4 and IPv6 source ranges to reach the origin, and check whether an AAAA record points at an unroutable or differently configured IPv6 address. A packet capture can show whether a SYN receives a response, but it cannot decrypt TLS and should be retained securely. For complete evidence, downloading files in Telegram can preserve timestamps and byte-for-byte log content without cropping details; use an approved private channel.

Finally, compare the origin’s configuration with the path Cloudflare actually uses. An origin in an Azure Australia East or Australia Southeast region may be healthy over IPv4 but fail when Cloudflare selects IPv6. Record both address-family results, the exact hostname, edge source addresses and the listener used. This prevents a successful IPv4 retest from hiding a broken production route.

Turn diagnostics into a reliable response

Once the failing layer is identified, make one evidence-based change at a time and retain a before-and-after test. A durable response depends on repeatable checks, documented ownership and clear escalation rather than repeated restarts.

After the correction, repeat the same edge and origin tests and watch the logs through at least one complete certificate-negotiation cycle. For an Australian-facing .com.au or .au service, give the hosting provider the exact domain, SNI value and timestamps in both UTC and local time. If investigation reveals exposed credentials or private key material, follow Australian Cyber Security Centre incident guidance and involve legal and security owners. Open Cloudflare’s SSL/TLS overview, save one failing capture and use it to verify that the origin now presents the expected certificate and completes the handshake.