Browser showing Cloudflare Error 526 Invalid SSL Certificate
# website errors# troubleshooting

Cloudflare Error 526: Invalid SSL Certificate Fix

A Cloudflare Error 526 means Cloudflare successfully connected to your origin server and completed the SSL handshake, but couldn't validate the SSL certificate your origin presented. The certificate exists and the handshake worked technically, but something about the certificate itself is wrong.

This error only occurs when your Cloudflare SSL mode is set to Full (Strict), which requires a valid, trusted certificate on your origin. Understanding the difference between SSL modes is key to fixing this.

What Does a Cloudflare Error 526 Mean?

Cloudflare's SSL modes determine how strictly it validates your origin's certificate:

  • Flexible: Cloudflare connects to your origin over HTTP. No origin certificate needed.
  • Full: Cloudflare connects over HTTPS but accepts any certificate, including self-signed or expired.
  • Full (Strict): Cloudflare connects over HTTPS and requires a valid certificate — one that is trusted, not expired, and matches the domain.

A 526 only appears in Full (Strict) mode. It means Cloudflare validated the certificate and found a problem. The handshake itself succeeded (unlike a 525 error), but the certificate failed trust validation.

Common Causes of a Cloudflare Error 526

1. Self-Signed Certificate on Origin

You generated a self-signed certificate for your origin server. Cloudflare in Full (Strict) mode doesn't trust self-signed certificates because no certificate authority (CA) vouches for them.

# Check if the certificate is self-signed
echo | openssl s_client -connect YOUR_ORIGIN_IP:443 -servername yourdomain.com 2>/dev/null | openssl x509 -noout -issuer -subject

# Self-signed example:
# issuer=CN = yourdomain.com
# subject=CN = yourdomain.com
# (issuer and subject are the same)

2. Expired Certificate

The certificate was valid but has expired. Cloudflare can't trust an expired certificate in Strict mode.

# Check expiry dates
echo | openssl s_client -connect YOUR_ORIGIN_IP:443 -servername yourdomain.com 2>/dev/null | openssl x509 -noout -dates

# notBefore=Jan 15 00:00:00 2025 GMT
# notAfter=Jan 15 00:00:00 2026 GMT  <-- expired

3. Certificate Doesn't Match the Domain

The certificate is valid and trusted, but it was issued for a different domain. If your site is example.com but the certificate is for otherdomain.com, Cloudflare rejects it.

# Check which domains the certificate covers
echo | openssl s_client -connect YOUR_ORIGIN_IP:443 -servername yourdomain.com 2>/dev/null | openssl x509 -noout -text | grep -A1 "Subject Alternative Name"

4. Missing Intermediate Certificate Chain

Your origin server has a valid certificate but isn't sending the complete certificate chain. The intermediate certificates that link your certificate to a trusted root CA are missing, so Cloudflare can't verify the trust chain.

# Check the certificate chain
echo | openssl s_client -connect YOUR_ORIGIN_IP:443 -servername yourdomain.com 2>/dev/null | grep -E "^(Certificate chain| [0-9]+ s:)"

# A complete chain should show multiple certificates:
# 0 s:CN = yourdomain.com
# 1 s:CN = Let's Encrypt Authority X3
# 2 s:CN = DST Root CA X3

If you only see certificate 0, the intermediates are missing.

5. Incorrect Certificate Installed

The wrong certificate file was installed on the server. This can happen after a renewal when the old certificate file gets referenced instead of the new one, or when certificates for different domains get mixed up.

6. Certificate Authority Not Trusted

Your certificate was issued by a CA that Cloudflare doesn't recognise. This is rare with standard CAs (Let's Encrypt, DigiCert, Comodo, etc.) but can happen with private or internal CAs.

How to Fix a Cloudflare Error 526

Cloudflare Origin Certificates are specifically designed for this purpose. They're free, last up to 15 years, and are always trusted by Cloudflare in Full (Strict) mode.

  1. In Cloudflare dashboard: SSL/TLS > Origin Server > Create Certificate.
  2. Choose the hostnames to cover (e.g., example.com and *.example.com).
  3. Select the validity period (up to 15 years).
  4. Download the certificate and private key.

Install them on your server:

Nginx:

server {
    listen 443 ssl;
    server_name yourdomain.com;

    ssl_certificate /etc/ssl/cloudflare/origin.pem;
    ssl_certificate_key /etc/ssl/cloudflare/origin-key.pem;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;
}

Apache:

<VirtualHost *:443>
    ServerName yourdomain.com

    SSLEngine on
    SSLCertificateFile /etc/ssl/cloudflare/origin.pem
    SSLCertificateKeyFile /etc/ssl/cloudflare/origin-key.pem
</VirtualHost>
# Restart the web server
sudo nginx -t && sudo systemctl reload nginx
# or
sudo apachectl configtest && sudo systemctl reload apache2

Option 2: Install a Let's Encrypt Certificate

A free, auto-renewing certificate from a trusted CA:

# Install certbot
sudo apt-get update
sudo apt-get install certbot python3-certbot-nginx

# Generate and install certificate
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

# Verify auto-renewal is working
sudo certbot renew --dry-run

Option 3: Fix the Certificate Chain

If you have a valid certificate but the intermediates are missing, concatenate them:

# Create a full chain file
cat your-domain-cert.pem intermediate-cert.pem > fullchain.pem

Update your server config to use the full chain:

# Nginx
ssl_certificate /etc/ssl/fullchain.pem;
ssl_certificate_key /etc/ssl/private-key.pem;
# Apache
SSLCertificateFile /etc/ssl/fullchain.pem
SSLCertificateKeyFile /etc/ssl/private-key.pem

Option 4: Switch to Full Mode (Less Secure)

If you need a quick fix, you can change the SSL mode from Full (Strict) to Full in the Cloudflare dashboard under SSL/TLS > Overview. This makes Cloudflare accept any certificate, including self-signed and expired ones.

Important: This reduces security. In Full mode, a man-in-the-middle attack between Cloudflare and your origin could go undetected. Use this only as a temporary measure while you fix the certificate.

Verify the Fix

After installing or fixing the certificate:

# Test the certificate directly
echo | openssl s_client -connect YOUR_ORIGIN_IP:443 -servername yourdomain.com 2>/dev/null | openssl x509 -noout -subject -issuer -dates

# Test through Cloudflare
curl -I https://yourdomain.com

# Verify the full chain
echo | openssl s_client -connect YOUR_ORIGIN_IP:443 -servername yourdomain.com 2>&1 | grep "Verify return code"
# Should show: Verify return code: 0 (ok)

How Domain Monitor Can Help

A 526 error makes your site completely inaccessible. SSL certificate problems are especially dangerous because they can happen suddenly — a certificate expires overnight, an auto-renewal fails silently, or a server rebuild forgets to include the intermediate chain. You need to know about these failures the moment they happen, not when you check your traffic stats days later and see a cliff.

Domain Monitor checks your site every minute from multiple locations, detecting 526 errors and other Cloudflare SSL issues immediately. You'll receive an alert via email, SMS, or Slack within seconds. Domain Monitor also monitors your SSL certificates directly, warning you before they expire so you can renew proactively. Set up downtime alerts for your domains and use comprehensive website monitoring to ensure your SSL configuration stays healthy.

Quick Summary

CauseFix
Self-signed certificateInstall Cloudflare Origin Certificate or Let's Encrypt
Expired certificateRenew the certificate, set up auto-renewal
Domain name mismatchInstall a certificate for the correct domain
Missing intermediate chainConcatenate intermediates into fullchain.pem
Untrusted CAUse a publicly trusted CA
Wrong SSL modeUse Full (Strict) with a valid certificate

A 526 means "your certificate exists but isn't valid." The fix is almost always straightforward: install a proper, trusted certificate on your origin and ensure the full chain is served. Cloudflare Origin Certificates are the easiest and most reliable option for sites behind Cloudflare.

More posts

Wildcard vs SAN vs Single-Domain SSL Certificates: Which Do You Need?

Wildcard, SAN (multi-domain), and single-domain SSL certificates cover different use cases. Here's a clear comparison to help you pick the right type — and avoid paying for coverage you don't need.

Read more
Why DNS Works in One Location but Fails in Another

DNS resolves correctly from your office but fails for users in other countries or on different ISPs. Here's why geographic DNS inconsistency happens and how to diagnose which layer is causing it.

Read more
Registrar Lock vs Transfer Lock: What's the Difference?

Registrar lock and transfer lock are often confused — and disabling the wrong one leaves your domain vulnerable. Here's a clear breakdown of what each does and when to use them.

Read more

Subscribe to our PRO plan.

Looking to monitor your website and domains? Join our platform and start today.