Rack cabinet with servers in a data center

Cloudflare error 526 “Invalid SSL certificate” means the zone is set to Full (strict) SSL/TLS mode and the certificate presented by the origin server failed Cloudflare’s validation. The connection between the visitor and Cloudflare is fine; the leg between Cloudflare and your server is what breaks. The cause is almost always one of four things: an expired certificate, a self-signed one, one issued for a different name, or one served without its full chain. This guide shows how to tell which, and how to fix it without lowering your security level.

Key points on Cloudflare error 526 in 30 seconds

  • It only appears in Full (strict) or Strict mode, where Cloudflare requires a valid, trusted certificate at the origin.
  • You diagnose it by connecting straight to the server’s IP with curl or openssl.
  • Typical causes: expiry, self-signed certificate, hostname mismatch or incomplete chain.
  • Switching to Full or Flexible makes the error go away but removes protection on the origin leg.
  • With 200-day certificates since March 2026, automated renewal is a must.

Cloudflare’s own documentation defines 526 as the case where it cannot validate the origin certificate while Full (strict) is enabled. In plain Full mode, Cloudflare still encrypts the connection to the origin but accepts any certificate, even an expired or self-signed one, so the same server would not throw an error. That is why 526 tends to appear suddenly at one of two moments: when a certificate that stopped renewing finally expires, or right after someone raises the mode to Full (strict) on a server that had been running an invalid certificate all along without anyone noticing.

Diagnose the certificate by bypassing Cloudflare

Start by checking which certificate the server actually hands out, connecting to its IP without going through Cloudflare. With curl, --resolve pins the IP without touching DNS or the hosts file (replace the domain and IP with your own):

curl -vI https://example.com --resolve example.com:443:203.0.113.10Code language: JavaScript (javascript)

openssl gives more detail. The -servername flag matters: it sends the name in the TLS handshake (SNI), as Cloudflare does, so the server picks that site’s certificate rather than its default one:

# Subject, issuer, dates and alternative names
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates -ext subjectAltName

# Show the chain the server sends (s: subject, i: issuer)
openssl s_client -connect 203.0.113.10:443 -servername example.com -showcerts </dev/null 2>/dev/null | grep -E ' s:| i:'

# Chain verification result
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>/dev/null | grep 'Verify return code'Code language: PHP (php)

Look at four things: the notAfter date (if it has passed, the certificate is expired); the issuer (if it matches the subject, it is self-signed); the Subject Alternative Names (they must include exactly the hostname visitors use, such as example.com and www.example.com); and the verify code, which should read 0 (ok). An error like “unable to get local issuer certificate” usually points to an incomplete chain.

Common causes and how to fix them

Expired certificate. The most frequent cause, almost always a Let’s Encrypt certificate that stopped renewing. Check and renew with Certbot, then reload the web server:

sudo certbot certificates
sudo certbot renew --dry-run
sudo certbot renew
sudo systemctl reload nginx     # or apache2 / httpd

# Make sure the renewal timer exists
systemctl list-timers | grep -i certbotCode language: PHP (php)

Behind Cloudflare, renewals often fail because the HTTP-01 challenge on port 80 is blocked by a firewall or redirected by rules such as “Always Use HTTPS” towards an HTTPS endpoint that is, precisely, broken. The most robust fix is DNS validation with Certbot’s Cloudflare plugin, which also allows wildcard certificates:

sudo apt install python3-certbot-dns-cloudflare

# ~/.secrets/cloudflare.ini with an API token scoped to Zone:DNS:Edit
# dns_cloudflare_api_token = YOUR_TOKEN
chmod 600 ~/.secrets/cloudflare.ini

sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials ~/.secrets/cloudflare.ini -d example.com -d '*.example.com'Code language: PHP (php)

Self-signed certificate. Full (strict) always rejects it. You have two options: a publicly trusted certificate, such as a free Let’s Encrypt one, or a Cloudflare Origin CA certificate, generated in the dashboard under SSL/TLS, Origin Server, with validity of up to 15 years. The latter is trusted only by Cloudflare, so the DNS record must stay proxied (orange cloud): anyone reaching the server directly, or a record switched to DNS-only, will get a browser warning.

Wrong name. A certificate for example.com does not cover www.example.com or app.example.com. Issue one that lists every name in use, or a wildcard. A related case is a server with no certificate for that name at all, which falls back to its default site’s certificate: in nginx, add the domain to server_name in the right block; in Apache, to ServerName or ServerAlias in the port 443 VirtualHost.

Incomplete chain. Browsers sometimes fill in missing intermediates on their own, but Cloudflare does not have to. In nginx, ssl_certificate must point to the full-chain file; with Certbot that is fullchain.pem, not cert.pem. On Apache 2.4.8 and later, SSLCertificateFile can point to fullchain.pem as well:

# nginx
ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

# Validate and reload
sudo nginx -t && sudo systemctl reload nginxCode language: PHP (php)

Don’t lower the SSL mode, and prevent the next failure

Cloudflare’s own help page lists switching from Full (strict) to Full as a quick fix, and it is tempting because the error disappears within seconds. But understand what you give up. In Full mode, Cloudflare stops verifying who is on the other end, so someone between Cloudflare and your server could impersonate it. Flexible is worse: traffic to the origin travels unencrypted. At most, use it as a stopgap for a few minutes while you renew the certificate, then go back to Full (strict). For an extra layer, Authenticated Origin Pulls makes the origin accept only connections that present Cloudflare’s client certificate.

Prevention matters more every year. Under CA/Browser Forum Ballot SC-081v3, approved in April 2025, the maximum validity of public certificates dropped to 200 days on 15 March 2026, and it will fall to 100 days on 15 March 2027 and to 47 days on 15 March 2029. Anyone still renewing by hand will have to do it several times a year, so ACME automation (Certbot, acme.sh or Caddy’s automatic management) and expiry monitoring are no longer optional. A simple check for a script or monitoring system:

# Exits with an error if the certificate expires within 14 days (1209600 seconds)
openssl x509 -checkend 1209600 -noout -in /etc/letsencrypt/live/example.com/fullchain.pemCode language: PHP (php)

Related errors you should not confuse it with

  • 525 SSL handshake failed: the TLS handshake never completes. Usually nothing is serving HTTPS on port 443, or the server’s protocols and ciphers don’t overlap with Cloudflare’s. A handy test: if dropping to Full makes the error go away, it was a validation problem (526); if it persists, it is a handshake problem (525).
  • 521 Web server is down: Cloudflare cannot connect to the server. The web service is down or a firewall blocks Cloudflare’s IP ranges.
  • 502 and 503: these come from your server or application, not from the certificate.

FAQ

What does Cloudflare error 526 mean?

The zone is in Full (strict) mode and Cloudflare could not validate the origin certificate: it is expired, self-signed, issued for another name or missing its chain.

Can I switch to Full mode to clear the error?

It works, but Cloudflare stops verifying the server, which allows impersonation. Use it only for a few minutes while you fix the certificate.

Is a Cloudflare Origin CA certificate good enough?

Yes, Full (strict) accepts it and it can last up to 15 years, but only Cloudflare trusts it, so the record must stay proxied.

Why does Let’s Encrypt renewal fail behind Cloudflare?

Often because the HTTP challenge on port 80 is blocked or redirected. DNS validation with Certbot’s Cloudflare plugin avoids the problem.

Sources:

Scroll to Top