Skip to content

Cloudflare error 526: invalid SSL certificate — what the origin cert got wrong

Cloudflare error 526 means the TLS handshake to your origin worked but the certificate failed validation: expired, self-signed, wrong hostname, or missing chain. Here is how to identify the exact defect and fix it.

Cloudflare error 526 means the edge connected to your origin, completed the TLS handshake, and then rejected what it saw: the origin’s certificate failed validation. It appears when the zone’s SSL/TLS mode is Full (Strict) — the one mode that actually checks the certificate — and the cert is expired, self-signed, issued for a different hostname, missing its intermediate chain, or signed by a CA Cloudflare does not trust. One openssl command tells you which defect you have, and each defect has a specific one-step fix.

What’s happening

In Full (Strict) mode, every connection from the edge to your origin includes certificate validation, the same way a browser would do it: is the cert within its validity dates, does its SAN cover the requested hostname, does the chain lead to a trusted root, and is it not self-signed? Fail any check and the edge refuses to proceed, serving the 526 page instead of origin content. The neighbouring failure is 525 — there the handshake itself collapses; with 526 the handshake works and trust fails. Cloudflare’s SSL/TLS documentation covers the validation model, and the status code reference lists the exact conditions.

Two details operators regularly miss. First, Cloudflare validates against its own trust store plus Cloudflare Origin CA — so an Origin CA certificate, which no browser would accept, passes Full (Strict) perfectly, because only Cloudflare ever connects to the origin for proxied traffic. Second, a missing intermediate certificate causes 526 even when “the cert is valid”: the origin must serve the full chain, because the edge does no missing-intermediate fetching. Validation behaviour is identical on Free, Pro, and Business plans.

What to check first

  • Did a certificate expire overnight? 526s that start at a suspiciously clean timestamp are almost always an expiry.
  • Did the SSL mode just get raised to Full (Strict)? If the origin has always run self-signed, the mode change is the trigger — the cert was invalid all along, unchecked.
  • Does the SAN cover the exact hostname? Cert for example.com, request for www.example.com, no wildcard: that is a 526.
  • Was the cert renewed but the chain file forgotten? Renewals that swap the leaf but not the bundle produce chain-validation failures.
  • cPanel origin? AutoSSL’s renewal quirks are their own topic — see the cPanel 525/526 walkthrough.

How to verify

Interrogate the certificate exactly as the edge sees it — against the origin IP, with SNI:

# What cert does the origin serve for this hostname, and is it in date?
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>&1 \
  | openssl x509 -noout -subject -issuer -dates

# Does the SAN list actually cover the hostname?
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>&1 \
  | openssl x509 -noout -ext subjectAltName

# Is the served chain complete and verifiable?
openssl s_client -connect 203.0.113.10:443 -servername example.com -showcerts </dev/null 2>&1 \
  | grep -E 'verify return|verify error|s:|i:'

# Full request ignoring trust, to confirm everything else works
curl -skI --resolve example.com:443:203.0.113.10 https://example.com/

Map the output to the defect: notAfter in the past is an expiry; subject equal to issuer is self-signed; a SAN list without your hostname is a coverage miss; unable to get local issuer certificate with only one s:/i: pair in the chain dump is a missing intermediate. If curl -skI returns your site normally, the origin is otherwise healthy and the certificate really is the whole problem.

The fix

  1. Expired certificate — renew and deploy it, then find out why automation did not: a disabled timer for certbot renew, an ACME HTTP-01 challenge that stopped passing once the site went behind the proxy, or a renewal that succeeded but never triggered a web server reload. Fix the automation, or the 526 returns in 90 days.
  2. Self-signed or untrusted-CA certificate — replace it with either a publicly trusted cert or, simpler for proxied-only origins, a Cloudflare Origin CA certificate issued from SSL/TLS → Origin Server. Fifteen-year validity and automatic trust in Full (Strict); the trade-off is that browsers must never hit the origin directly. Full deployment steps are in origin certificates end to end.
  3. Hostname not covered by the SAN — reissue the certificate to include every hostname Cloudflare will request from this origin: apex, www, and any proxied subdomains, or use a wildcard for the level. Check the vhost is actually serving the new cert for each name afterwards.
  4. Missing intermediate chain — configure the origin to serve the full chain: fullchain.pem (not cert.pem) in Nginx’s ssl_certificate; in Apache 2.4.8+, the chain belongs concatenated in the SSLCertificateFile. Reload and re-run the -showcerts check until verify return:1 appears at every link.
  5. Stopgap only: lower the mode to Full — under SSL/TLS → Overview, Full accepts any cert and the 526 vanishes immediately, buying time during an incident. It removes authentication of the origin hop, so treat it as a tourniquet with a ticket attached, and put Full (Strict) back once the certificate is fixed.

When this fix is wrong

If openssl shows a valid, in-date, correctly chained certificate for the right hostname and 526s continue, you are probably not testing what Cloudflare talks to — a load balancer or CDN-in-front-of-CDN layer may present a different certificate than the backend you tested, or an old AAAA record is steering the edge to a different machine than your A record. Verify every record and every hop that can terminate TLS before touching the cert again.

Common mistakes

  • Setting the zone to Full permanently instead of fixing the certificate — silent loss of origin authentication that nobody revisits.
  • Renewing the leaf certificate but deploying it without the new chain file.
  • Testing in a browser through Cloudflare and concluding the cert is fine — the browser sees the edge certificate, never the origin’s.
  • Issuing an Origin CA cert and then pointing non-proxied services (mail clients, monitoring, a grey-clouded hostname) at the same origin port, where that cert is rightly untrusted.

Prevention

  • Monitor origin certificate expiry directly by IP with SNI, alerting at 21 days — separate from any check that goes through the proxy.
  • Make “web server reloaded and openssl re-verified” part of the renewal automation, not a manual afterthought.
  • Standardize on Origin CA certificates for proxied-only origins to exit the 90-day renewal treadmill entirely.
  • Keep an inventory of which hostnames each origin cert must cover, and review it when adding proxied subdomains.
  • After raising a zone to Full (Strict), test every proxied hostname, not just the main site — the forgotten api subdomain is the classic day-two 526.

A 526 is the most mechanical of the Cloudflare TLS errors: one specific validation check failed, and openssl will name it. If the error keeps coming back, the problem usually sits between Cloudflare and the origin — Stack Harbor operates that whole path under Managed Cloud Ops, and you can book an infrastructure review.