Skip to content
AdminKit

Checking TLS certificate chain completeness: why a 'valid' certificate can still fail

A TLS certificate chain is complete when the server sends every intermediate certificate between its leaf and a trusted root, as RFC 5280 path validation requires. Browsers often hide a missing intermediate; curl, mobile apps and mail servers often don't. AdminKit's SSL/TLS check reads the leaf certificate, and this guide shows how to check the rest.

By AdminKit team, Netbase JSC · Updated

Key takeaways

  • A chain is complete when the server sends its leaf certificate plus every intermediate up to, but not including, a root the client already trusts.
  • Browsers often hide a missing intermediate by caching or fetching it. curl, mobile apps, API clients and mail servers often don’t, so the same server fails for them.
  • TLS 1.3 requires the leaf to come first. Each following certificate should certify the one before it, and the root may be left out.
  • The fix is nearly always configuration: point the server at the full-chain file (fullchain.pem from Certbot), not the leaf-only file.
  • AdminKit’s SSL/TLS check reads the leaf certificate only. Use openssl s_client -showcerts to see and verify what the server actually sends.

What does a complete chain look like?

A server’s TLS certificate (its leaf certificate) is signed by a certificate authority, but that CA almost never signs leaf certificates directly with its own root key — instead it signs with one or more intermediate certificates, keeping the root key itself offline and rarely used. RFC 5280 (canonical record on the IETF Datatracker) defines certification path validation as building and checking this entire sequence: the leaf must be signed by the next certificate up, that one signed by the next, and so on until the path reaches a root the validating client already trusts. Every individual signature in that sequence can be mathematically valid, and the whole path still fails to validate if even one certificate in the middle — an intermediate — is missing from what the server actually sent.

This is what “chain completeness” means in a certificate check result: not whether the leaf certificate itself is well-formed, but whether the server handed over every certificate a client needs to walk that full path, with nothing missing in between.

A typical three-level chain, with illustrative names, looks like this:

PositionCertificateSigned byServer should send it?
0 (leaf)example.comExample Issuing CA 1Yes, first
1 (intermediate)Example Issuing CA 1Example Root CAYes, second
2 (root)Example Root CAItselfNo, clients already have it

Some CAs use two intermediates, and some offer more than one valid chain for the same leaf. Let’s Encrypt’s chain of trust page, for example, lists two roots (ISRG Root X1 and ISRG Root X2) and several intermediates in active rotation. The rule stays the same: send everything between your leaf and the root.

Why does it work in a browser but fail everywhere else?

The most common way an incomplete chain goes unnoticed is that it happens to work in whichever browser someone tested it in. Two browser behaviors mask the gap, and neither one is guaranteed by any specification:

  • Caching. If a browser has already seen a given intermediate certificate while visiting a different, correctly configured site, it can reuse that cached copy to complete the path even though the server in front of it never sent that intermediate. nginx’s HTTPS documentation describes exactly this: actively used browsers “may already have the required intermediate certificates and may not complain about a certificate sent without a chained bundle”.
  • AIA chasing. RFC 5280 §4.2.2.1 defines the Authority Information Access extension, which a certificate can use to point at a URL where its issuer’s certificate can be fetched. Some clients — notably Windows’ certificate validation and some browsers — will fetch a missing intermediate this way if the extension is present.

Neither mechanism is something RFC 5280 requires a client to implement, and plenty of real clients implement neither: curl and most non-browser HTTP libraries validate strictly against what the handshake actually delivered, many mobile app TLS stacks behave the same way, Java’s default trust manager does not chase AIA URLs, and mail transfer agents validating a STARTTLS certificate typically don’t either. The result is a server that looks completely healthy to whoever tested it in a browser, while quietly failing every API client, mobile app, and mail server that talks to it.

What does TLS say about order and the root?

RFC 8446 §4.4.2, the TLS 1.3 specification, sets three rules for the certificate list a server sends:

  1. “The sender’s certificate MUST come in the first CertificateEntry in the list.”
  2. “Each following certificate SHOULD directly certify the one immediately preceding it.”
  3. A certificate that specifies a trust anchor (the root) “MAY be omitted from the chain”, provided peers are known to have it.

The same section admits that real servers get this wrong. Some send both a current and an old intermediate, and others “are simply configured incorrectly”. For that reason it asks every implementation to “be prepared to handle potentially extraneous certificates and arbitrary orderings”, except that the leaf must always be first. In practice, a modern client often tolerates a jumbled order or an extra root, but no client can invent an intermediate that was never sent and that it cannot fetch.

What the server sendsTypical effectFix
Leaf onlyFails in clients without a cached copy or AIA fetchingServe the full-chain file
Leaf + intermediates, out of orderUsually tolerated by TLS 1.3 clients; can fail in older onesLeaf first, then each issuer in turn
Leaf + intermediates + rootWorks, but the root is extra bytes in every handshakeDrop the root
Leaf + an old intermediate from before a CA rotationPath may not build to a trusted rootUse the chain your CA or ACME client currently issues
Intermediates first, leaf laterLeaf is not first; on nginx the server will not start (see below)Put the leaf first

How do you check whether your chain is complete?

AdminKit’s SSL/TLS check completes a real handshake and reads the certificate the server presents: its names, issuer, validity dates and the negotiated protocol. It does not validate the chain against a root store, so a “no findings” result there says nothing about intermediates. See how to read a TLS/SSL certificate check result for how those other fields are reported.

To see the chain itself, use OpenSSL. The s_client manual notes that -showcerts displays the list “as sent by the server” and that it “is not a verified chain”; the verification result is printed separately. The output below is an illustrative, shortened example of a leaf-only server at the documentation domain example.com, not a capture from a real host:

$ openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null
depth=0 CN = example.com
verify error:num=20:unable to get local issuer certificate
verify error:num=21:unable to verify the first certificate
---
Certificate chain
 0 s:CN = example.com
   i:C = US, O = Example CA, CN = Example Issuing CA 1
---
    Verify return code: 21 (unable to verify the first certificate)

Two things give it away: the chain lists only entry 0, and the verify return code is not 0 (ok). On a healthy server you would see entry 1 for the intermediate and Verify return code: 0 (ok). Add -verify_return_error if you want the command to stop with an error, which is useful in a script or CI job. Run it from a machine that does not share a browser’s intermediate cache; a plain server or container is ideal.

How do you fix an incomplete chain?

The fix is almost always the same regardless of which CA issued the certificate: configure the web server to serve the leaf certificate together with every required intermediate, in one ordered bundle, instead of the leaf alone. Certificate authorities generally publish this bundle ready-made — Let’s Encrypt, for example, whose certificates are typically issued and renewed automatically via the ACME protocol, documents a fullchain.pem file — PEM format is the base64 text container most certificates and keys are distributed in — that already concatenates the leaf and the intermediate it needs — and the common root cause of an incomplete chain is a server configuration pointing at the leaf-only certificate file instead of that bundle. RFC 8446 specifies the TLS Certificate message as an ordered list, so the broadly interoperable convention is leaf first, then each intermediate in order; a root certificate at the end is unnecessary (clients already have it) and best left out.

Certbot’s user guide spells out its files: fullchain.pem holds the server certificate first, followed by any intermediates; cert.pem holds the server certificate by itself, and chain.pem holds only the intermediates. If you configure cert.pem, you must also configure chain.pem, or some clients will fail. The safe choice on current servers is fullchain.pem:

# nginx: one file, leaf first, then intermediates
ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# Apache httpd 2.4.8 or later: SSLCertificateFile may include intermediates
SSLCertificateFile    /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

Apache’s mod_ssl documentation says the file may include intermediate certificates “sorted from leaf to root” from version 2.4.8, which made SSLCertificateChainFile obsolete. If your CA sends a separate bundle instead, nginx documents concatenating them yourself, server certificate first. If the order is wrong, nginx refuses to start with a “key values mismatch” error, because it pairs the private key with the first certificate in the file.

Chains also change over time. Let’s Encrypt says it maintains four intermediates in active rotation, so your next certificate may come from a different intermediate than the last one. Never hard-code an intermediate into your configuration. Reload the web server after each renewal, so it serves the chain your ACME client just wrote rather than an old one in memory.

Next step: check your own chain

Run AdminKit’s SSL/TLS check against your hostname for the certificate’s names, expiry and negotiated protocol, then run the openssl s_client command above to confirm the chain resolves cleanly to a trusted root. If the chain is complete but you’re deciding which CA should be allowed to issue for the domain at all, see what CAA records are and how they limit issuance. Chain completeness is one piece of a wider picture — see AdminKit’s security basics cluster for the related checks on certificates, headers, and the rest of a site’s exposed surface.

The same chain-completeness concept applies if a server also serves HTTP/3 over QUIC: QUIC carries its own TLS 1.3 handshake, including the certificate chain, over UDP rather than TCP, so a chain gap fixed here on the TCP side needs the QUIC-serving configuration checked separately too — AdminKit’s check and the openssl s_client command above both use a TCP handshake.

This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.

Frequently asked questions

If my certificate itself is valid and not expired, why would a connection still fail?

Because chain validation is a separate step from checking the leaf certificate's own fields. RFC 5280's certification path validation requires building an unbroken sequence of certificates from the leaf up to a trusted root, each one signed by the next. A server that sends only its leaf certificate, omitting the intermediate certificate that signed it, breaks that sequence even though the leaf certificate itself is perfectly valid — the client simply has no way to link it to a root it trusts.

Why does the site work in Chrome but fail in curl, a mobile app, or a mail server?

Many desktop browsers cache intermediate certificates they've already seen from other sites, and some also perform AIA chasing (fetching a missing intermediate automatically) using the Authority Information Access extension RFC 5280 defines. Neither behavior is mandated by the RFC, so it varies by client: command-line tools like curl, many mobile app TLS stacks, Java's default trust manager, and most mail transfer agents validate only what the server actually sends in the handshake, with no caching and no fetching, so the exact same misconfigured server that 'works' in a browser fails outright for them.

What's the actual fix for an incomplete chain?

Configure the server to send every intermediate certificate between its leaf and a trusted root, in addition to the leaf itself. Most certificate authorities publish a ready-made bundle for this — for example, a file commonly named fullchain.pem — that already concatenates the leaf and the required intermediate(s) in the right order; the fix is almost always pointing the web server's TLS configuration at that bundle instead of the leaf certificate alone.

Does the order of certificates in the chain matter?

Yes, for interoperability, even though RFC 5280's path-validation logic can in principle work out the links regardless of order. The TLS specification RFC 8446 defines the certificate message sent during the TLS handshake as an ordered list, and the broadly compatible convention is leaf certificate first, followed by each intermediate in order up toward (but usually not including) the root — sending them out of order or appending an unnecessary root certificate is a common secondary mistake alongside leaving an intermediate out entirely.

If AIA chasing exists, why not just rely on it instead of fixing the server?

Because RFC 5280's Authority Information Access extension is optional for a client to act on, not a guaranteed fallback. It's a courtesy some clients implement and many don't, and even where it's supported it adds an extra network fetch and a dependency on that fetch succeeding at the exact moment a client needs it — relying on it means a meaningful slice of real-world clients fail outright rather than slowing down. Serving the complete chain yourself costs nothing and removes the dependency entirely.

Want AdminKit to watch this for you?

Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.

Huy Nguyen (David), Founder and CEO of Netbase JSC

Talk to an expert

Huy Nguyen (David), Founder & CEO, Netbase JSC

Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.