Skip to content

Origin certificate expired or invalid: Cloudflare 526 symptoms and renewal

The site ran fine for months, then every visitor gets Error 526. The origin certificate expired — often a Let's Encrypt certificate that quietly stopped renewing behind the proxy. How to confirm the expiry, renew or replace the certificate, and get off the 90-day treadmill.

Error 526 on a zone running Full (Strict) means Cloudflare reached your origin, received a certificate, and refused it: expired, wrong hostname, untrusted issuer, or a missing intermediate. The most common real-world version is a Let’s Encrypt certificate at the origin that stopped renewing — the site dies roughly 90 days after the day everything “just worked”. Confirm what the origin is serving with openssl, renew or replace the certificate, reload the web server, and the 526 clears immediately.

What’s happening

Certificate validation on the origin hop only happens in Full (Strict) mode. Plain Full encrypts the hop but accepts anything, expired and self-signed included — which is why a temporary downgrade to Full is a useful diagnostic: if the site comes back the moment you switch, certificate validity is your confirmed problem, and you switch back after fixing it. The behaviour is identical on Free, Pro, and Business plans.

Why origin certificates go stale behind Cloudflare: Let’s Encrypt renewals rely on the ACME challenge completing, and edge features — challenge pages, WAF rules, redirects on the validation path — can silently break HTTP-01 while everything else keeps working. The certificate keeps counting down, nobody notices, and day 90 arrives. The neighbouring failure codes matter too: 525 means the TLS handshake never completed (no certificate involved), and the split between the two is covered in 525/526 handshake errors.

What to check first

  • What the origin serves right now — not what you believe was installed.
  • The exact expiry date, and whether the SAN list still covers the hostname.
  • What was supposed to renew it: a certbot timer, an acme.sh cron job, panel AutoSSL — and whether that mechanism has logged errors.
  • Recent changes: server migration, backup restore, or a vhost rewrite that resurrected an old certificate file.

How to verify

# What is the origin serving, and when does it expire?
openssl s_client -connect <origin-ip>:443 -servername example.com </dev/null 2>&1 \
  | openssl x509 -noout -subject -issuer -dates

# Quick expiry check only
echo | openssl s_client -connect <origin-ip>:443 -servername example.com 2>/dev/null \
  | openssl x509 -noout -enddate

# The chain as served — a leaf with no intermediate shows here
openssl s_client -connect <origin-ip>:443 -servername example.com -showcerts </dev/null 2>&1 \
  | grep -E " s:| i:"

# If Let's Encrypt manages it: state and timer
sudo certbot certificates
systemctl list-timers | grep -i certbot

Read the notAfter date first. Then compare certbot certificates with what the server actually serves — a renewed certificate on disk plus an old one in memory means someone renewed without reloading.

The fix

  1. Classify the failure. Expired (notAfter in the past), hostname mismatch (SAN list lacks the name Cloudflare asks for), untrusted issuer (self-signed or private CA), or incomplete chain (only the leaf shows in -showcerts). Each has a different step below.
  2. Expired Let’s Encrypt certificate: renew, then fix the renewer. Run sudo certbot renew and read the output instead of forcing it blindly. If the HTTP-01 challenge fails behind the proxy, switch that certificate to DNS-01 with the Cloudflare DNS plugin and a scoped API token — the proxy then has no say in validation. Repeated forced renewals burn through Let’s Encrypt duplicate-certificate rate limits, so diagnose before retrying.
  3. Hostname mismatch: reissue with the right names. The certificate must cover the exact hostname Cloudflare connects with — www and apex are separate names, and a deep subdomain is not covered by a single-level wildcard.
  4. Incomplete chain: serve the full chain. For public certificates, Nginx’s ssl_certificate must point at fullchain.pem, not cert.pem; modern Apache takes the chain in SSLCertificateFile. Cloudflare validates against a standard CA bundle and a missing intermediate reads as untrusted.
  5. Or step off the treadmill entirely. If the hostname only ever exists behind the proxy, replace the public certificate with a Cloudflare Origin CA certificate — up to 15 years of validity, trusted by Full (Strict), no ACME dependency. Details on the trade-offs are in origin certificates end to end, and Cloudflare’s reference is at developers.cloudflare.com/ssl/.
  6. Reload and confirm. Reload Nginx or Apache, re-run the openssl dates check against the origin, then request the site through the edge. Cloudflare does not cache 526 pages, so recovery is immediate — no purge required.

When this fix is wrong

If only some hostnames throw 526 while others work, you likely have a SAN coverage gap, not an expiry — renewing the same certificate reproduces the same failure. If the error is 525, stop looking at certificate dates: the handshake itself is failing (port closed, no TLS listener, protocol mismatch). And if errors are intermittent, check whether the hostname resolves to more than one origin — a load-balanced pair where one backend carries a stale certificate produces a maddening 50% failure pattern that no single-server fix resolves.

Common mistakes

  • Renewing the certificate and never reloading the web server — the old certificate keeps being served from memory, sometimes for weeks.
  • Replacing the certificate file but not the key it was issued with, so the service refuses to start.
  • Monitoring the certificate the browser sees. That is Cloudflare’s edge certificate, which Cloudflare renews itself; your origin certificate needs its own monitoring, checked against the origin IP directly.
  • Hammering --force-renewal into a rate limit during the outage, extending it by hours.

Prevention

Monitor the origin certificate where it lives: an external check that connects to the origin IP with SNI (exactly the first verify command) and alerts three weeks before notAfter turns this from an outage into a calendar entry. Run certbot renew --dry-run after any change to edge rules or redirects, since those are the changes that silently break future renewals. For proxied-only hostnames, prefer the Origin CA certificate and remove the renewal dependency altogether.

Getting end-to-end TLS right — edge, origin certificate, and the redirect chain — is standard work inside Managed Cloud Ops; book an infrastructure review if you want it verified end to end.