Skip to main content

Cloudflare 525 Error

Learning Focus

By the end of this lesson you will understand what causes Cloudflare 525 SSL Handshake Failed errors and how to fix the origin SSL configuration in OpenLiteSpeed.

What a 525 Means

A 525 error means Cloudflare could not complete the TLS handshake with your origin server. The connection reached your server, but the SSL negotiation failed before any data was exchanged.

Common Causes

CauseLikelihoodHow to Check
SSL listener not enabledVery commonWebAdmin → Listeners → check port 443
Wrong certificate pathVery commonls -la /path/to/cert.pem
Mismatched cert and keyCommonopenssl verify (see below)
TLS versions incompatibleOccasionalCheck listener TLS settings
Firewall blocking port 443Occasionalsudo ufw status or iptables -L
Expired certificateOccasionalopenssl x509 -enddate -noout -in cert.pem

Diagnostic Steps

Step 1: Verify the SSL Listener Exists

# Check if OpenLiteSpeed is listening on 443
sudo netstat -tlnp | grep 443

# Or using ss
sudo ss -tlnp | grep 443

If nothing is listening on 443, the SSL listener is not configured or not started.

Step 2: Test the TLS Handshake Directly

# Test from the server itself (bypassing Cloudflare)
openssl s_client -connect localhost:443 -servername example.com

# Look for:
# - "Verify return code: 0 (ok)" → certificate is valid
# - "SSL handshake has read ... bytes" → handshake completed
# - Errors like "Connection refused" → listener not running

Step 3: Verify Certificate and Key Match

# Get the certificate modulus hash
openssl x509 -noout -modulus -in /path/to/cert.pem | md5sum

# Get the key modulus hash
openssl rsa -noout -modulus -in /path/to/key.pem | md5sum

# These two hashes MUST match

Step 4: Check Certificate Expiry

openssl x509 -in /path/to/cert.pem -noout -dates
# notBefore=...
# notAfter=...

Step 5: Check Firewall

# UFW
sudo ufw status | grep 443

# iptables
sudo iptables -L -n | grep 443

Fix Checklist

FixCommand
Create SSL listener on 443Configure in WebAdmin → Listeners
Fix certificate pathUpdate path in WebAdmin → Listener → SSL
Regenerate matching cert/keyRe-issue from CA and upload both files
Open port 443 in firewallsudo ufw allow 443/tcp
Reload after changessudo /usr/local/lsws/bin/lswsctrl restart
warning

After fixing any SSL configuration, always test with openssl s_client before assuming the fix worked. Browser caching and Cloudflare edge caching can hide persistent issues.

Key Takeaways

  • 525 is a handshake problem between Cloudflare and your server, not a certificate trust issue.
  • The most common cause is a missing or misconfigured SSL listener on port 443.
  • Always verify with openssl s_client — it tests the exact handshake Cloudflare performs.
  • Check certificate path, key match, expiry, and firewall rules systematically.

What's Next