Skip to main content

How to Troubleshoot Cloudflare Error 525: SSL Handshake Failed

Cloudflare Error 525 occurs when the Cloudflare network is unable to establish a secure connection with your origin server during the SSL/TLS handshake. This typically indicates a configuration mismatch between the SSL certificate on your origin...

Cloudflare Error 525 occurs when the Cloudflare network is unable to establish a secure connection with your origin server during the SSL/TLS handshake. This typically indicates a configuration mismatch between the SSL certificate on your origin server and the settings in your Cloudflare dashboard.

Important: This error only occurs when the Cloudflare Proxy (the "Orange Cloud") is enabled for your DNS records.

Before you begin

You will need:

  • Access to your Cloudflare account

  • Access to your origin server's web server configuration (e.g., Nginx, Apache, or IIS)

  • The ability to verify the SSL certificate status on your origin server

Check the origin server's SSL certificate

The most common cause of a 525 error is an invalid or missing SSL certificate on the origin server.

  1. Verify that your origin server has a valid SSL certificate installed for the specific domain or subdomain.

  2. Ensure the certificate is not expired.

  3. Confirm that the certificate includes the correct Common Name (CN) or Subject Alternative Name (SAN) for your domain.

  4. Test the certificate directly by bypassing Cloudflare. You can do this by using a tool like curl to request the site directly from your server's IP address: curl -v --resolve yourdomain.com:443:123.123.123.123 https://yourdomain.com (Replace 123.123.123.123 with your actual origin server IP address).

If the certificate is invalid, expired, or missing, the SSL handshake will fail before it reaches Cloudflare.

Verify Cloudflare SSL/TLS settings

If your origin certificate is valid, the issue may be a mismatch between your Cloudflare settings and your server's capabilities.

  1. Log in to your Cloudflare dashboard.

  2. Select the account and website experiencing the error.

  3. Navigate to SSL/TLS > Overview.

  4. Check your Encryption mode.

    • If you are using a Full or Full (Strict) mode, your origin server must have a valid certificate.

    • If you are using Flexible mode, Cloudflare does not check the certificate on your origin server, but this mode is not recommended for modern security standards.

Note: If you are using Full (Strict) mode, Cloudflare requires a certificate signed by a trusted Certificate Authority (CA). If you are using a self-signed certificate, you must switch to Full mode.

Check for SNI (Server Name Indication) issues

If your server hosts multiple websites on a single IP address, it may fail to provide the correct certificate during the handshake.

  1. Ensure your web server is configured to support SNI.

  2. Verify that the web server is correctly identifying the requested hostname and presenting the matching certificate.

Confirm the origin server's IP address

If your origin server's IP address has changed but your Cloudflare DNS records still point to the old IP, the handshake may fail if the old IP no longer hosts the correct certificate.

  1. Verify the IP address in your Cloudflare DNS records.

  2. Ensure the IP matches the current IP of your origin server.

Confirm the port and protocol

Ensure your origin server is listening on the correct port for HTTPS traffic (typically port 443).

  1. Check your server's firewall to ensure port 443 is open to Cloudflare's IP ranges.

  2. Verify that your web server software is configured to listen on port 443.

How to Troubleshoot Cloudflare Error 525: SSL Handshake Failed

If you have verified that your certificate is valid and your Cloudflare settings are correct, but the error persists, the issue may be related to the specific handshake parameters.

Check for protocol mismatches

Ensure your origin server supports the TLS versions required by Cloudflare. If your server is restricted to an older version (like TLS 1.0 or 1.1) while Cloudflare is attempting a newer handshake, the connection will fail.

Verify the certificate chain

A common cause of "Handshake Failed" is a missing intermediate certificate on the origin server. Ensure your server provides the full certificate chain.

Contact Hostek support

If you have verified that your origin certificate is valid, your Cloudflare SSL settings are correct, and your server is reachable on port 443, contact Hostek support. Provide the following information to assist with the investigation:

  • The specific domain or subdomain experiencing the error.

  • A screenshot of your Cloudflare SSL/TLS settings.

  • The results of a curl command to your origin IP (as described in the first section).

Did this answer your question?