# Incomplete certificate chain: how to fix a missing intermediate certificate

> An incomplete certificate chain means the server omits its intermediate certificate. How to build fullchain.pem, configure four servers and check it.

Author: Joshua Martinelle, Security engineer at Tenable (https://www.websec0.com/guides/authors/joshua-martinelle/)
Canonical: https://www.websec0.com/guides/certificate-chain/
Updated: 2026-11-20
Tested on: nginx 1.28 to 1.31, Apache httpd 2.4.58 to 2.4.69, Caddy 2.9 to 2.11 and Traefik 2.11 to 3.7

## In short

- Serve your certificate and its intermediate certificates in one file, yours first. With Certbot, that file is `fullchain.pem`, not `cert.pem`.
- WebSec0 caps the TLS grade at B when the chain only validates after it downloads the missing intermediate itself, and at T when it cannot validate the chain at all.
- Browsers often hide the problem, but curl, OpenSSL and Go programs fail with "unable to get local issuer certificate".
- If the intermediate comes first in the file, Nginx, Apache and Caddy refuse to start. Traefik keeps running and serves its own default certificate, which WebSec0 grades T.
- Do not add the root certificate. It is harmless for the grade, but clients already have it.

## What is an incomplete certificate chain?

An **incomplete certificate chain** means your server sends its own
certificate but not the intermediate certificate that links it to a trusted
root. To fix it, point the server at a file that holds your certificate
followed by its intermediates. With Certbot, that file is `fullchain.pem`.

A public certificate authority signs your certificate with an intermediate
certificate, and the intermediate with its root. Clients only store the
roots. During the handshake, your server must send its certificate and every
intermediate, so the client can build the path to a root it trusts. Sending
the root itself is not needed: [RFC 8446](https://www.rfc-editor.org/rfc/rfc8446.html#section-4.4.2)
lets the server omit it.

## Why does it work in the browser and fail in curl?

Browsers often hide the problem. They keep intermediates they have seen on
other sites, as the [Nginx documentation](https://nginx.org/en/docs/http/configuring_https_servers.html#chains)
notes, and Firefox [downloads every intermediate](https://blog.mozilla.org/security/2020/11/13/preloading-intermediate-ca-certificates-into-firefox/)
disclosed to the CCADB in advance. Some clients also download the missing
certificate from the URL in your certificate's Authority Information Access
extension, defined in [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.html#section-4.2.2.1).

Other clients only use what your server sends. With the intermediate missing,
our test server failed in curl, OpenSSL and Go:

| Client | Error with `cert.pem` only |
| --- | --- |
| curl | Exit code 60, `unable to get local issuer certificate` |
| `openssl s_client` | `Verify return code: 21 (unable to verify the first certificate)` |
| Go `crypto/tls` | `x509: certificate signed by unknown authority` |

That covers API clients, webhooks, monitoring probes and scripts. A site can
look fine in every browser on your desk and still break for them.

## How WebSec0 checks the certificate chain

WebSec0 records the certificates your server sends in one handshake. It then
validates your certificate with only those intermediates, against the system
trust store, with Go's `crypto/x509`:

- **The chain validates.** The report shows the chain as trusted, with no cap.
- **It fails because an issuer is unknown.** WebSec0 follows the `CA Issuers`
  URL in your certificate, downloads the intermediate (DER or PEM, up to two
  levels) and tries again. If the chain now validates, the report shows
  "Incomplete chain", the highlight "Certificate chain is incomplete", and
  the TLS grade is capped at B.
- **It still fails.** The chain does not validate and the grade is capped
  at T.

The T cap also covers the other trust failures:

| Chain trust in the report | TLS grade cap |
| --- | --- |
| Incomplete chain | B |
| Expired | T |
| Self-signed | T |
| Hostname mismatch | T |
| Untrusted | T |

A missing intermediate gives T instead of B when WebSec0 cannot download it:
your certificate has no `CA Issuers` URL, the URL is unreachable or uses a
port other than 80 or 443, or it serves a PKCS#7 bundle (`.p7c`), which WebSec0 does not read.
The chain does not change the TLS score itself, only the cap.

We served each kind of certificate file on Nginx, Apache, Caddy and Traefik
and checked them the way WebSec0 does. The table lists the file the server
loads, the number of certificates it sent, and WebSec0's result. The results
were the same on every version we tested:

| File | Sent | WebSec0 |
| --- | --- | --- |
| `cert.pem` | 1 | Incomplete: B |
| `cert.pem`, URL unreachable | 1 | Untrusted: T |
| `fullchain.pem` | 2 | Trusted |
| `fullchain.pem` and root | 3 | Trusted |
| Intermediate first | none | No start; Traefik: T |

## Build the full chain file

### With Certbot

Certbot writes four files in `/etc/letsencrypt/live/<domain>/`. Use
`fullchain.pem` for the certificate and `privkey.pem` for the key.
`cert.pem` holds your certificate alone; the [Certbot guide](https://eff-certbot.readthedocs.io/en/stable/using.html#where-are-my-certificates)
says to use it only together with `chain.pem`, which modern servers do not
need.

### With a certificate from another CA

Certificate authorities usually deliver your certificate and a bundle of
intermediates in separate files. Concatenate them, your certificate first:

```sh
cat example.com.crt intermediate.crt > fullchain.pem
```

If you only have your certificate, download its intermediate from the
`CA Issuers` URL inside it. RFC 5280 requires a DER certificate there, which
the second line converts to PEM:

```sh
url=$(openssl x509 -in cert.pem -noout -ext authorityInfoAccess | sed -n 's/.*CA Issuers - URI://p' | head -1)
curl -fsS "$url" | openssl x509 -inform DER -out intermediate.pem
cat cert.pem intermediate.pem > fullchain.pem
```

RFC 5280 also allows a PKCS#7 bundle, usually with a URL ending in `.p7c`.
In that case, replace the second line's
`openssl x509 -inform DER -out intermediate.pem` with
`openssl pkcs7 -inform DER -print_certs -out intermediate.pem`.

### Check the file before you deploy it

List the certificates in the file, in order:

```sh
openssl crl2pkcs7 -nocrl -certfile fullchain.pem | openssl pkcs7 -print_certs -noout
```

The first `subject` must be your domain, and each `issuer` must be the
`subject` of the next certificate. For a Let's Encrypt certificate issued in
November 2026, the output starts like this:

```text
subject=CN=example.com
issuer=C=US, O=Let's Encrypt, CN=YE2

subject=C=US, O=Let's Encrypt, CN=YE2
issuer=C=US, O=ISRG, CN=Root YE
```

Some CAs send more than one intermediate: that chain continued with two
cross-signed certificates up to ISRG Root X1. Keep every certificate your CA
puts in the chain file.

## Configure it on your server

### Nginx

`ssl_certificate` takes the full chain, your certificate first:

```nginx
server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate     /etc/ssl/example.com/fullchain.pem;
    ssl_certificate_key /etc/ssl/example.com/privkey.pem;
}
```

With the intermediate first, Nginx 1.28 to 1.31 refused to start with
`SSL_CTX_use_PrivateKey(...) failed (SSL: error:05800074:x509 certificate routines::key values mismatch)`.
Run `sudo nginx -t` before `sudo systemctl reload nginx` to catch it. The full
set of HTTPS headers for Nginx is in the [Nginx security headers hub](/guides/security-headers/nginx/).

### Apache

Since Apache 2.4.8, `SSLCertificateFile` takes the full chain, your
certificate first:

```apache
<VirtualHost *:443>
    ServerName example.com
    SSLEngine on
    SSLCertificateFile    /etc/ssl/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/ssl/example.com/privkey.pem
</VirtualHost>
```

`SSLCertificateChainFile` is [deprecated](https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslcertificatechainfile)
since 2.4.8. It still sent the intermediate on 2.4.58, 2.4.62 and 2.4.69 in
our tests, but a full chain in `SSLCertificateFile` replaces it. With the
intermediate first, Apache refused to start with `AH02565: Certificate and
private key ... do not match`. Check with `sudo apachectl configtest` before
you reload.

### Caddy

With certificates Caddy obtains itself, there is nothing to do: it sends the
intermediate with the certificate. If you load your own files with the `tls`
directive, the certificate file must hold the full chain:

```caddyfile
example.com {
	tls /etc/ssl/example.com/fullchain.pem /etc/ssl/example.com/privkey.pem
	respond "ok"
}
```

With your certificate alone, Caddy 2.9 to 2.11 started and sent an incomplete
chain. With the intermediate first, Caddy refused to start with
`tls: private key does not match public key`.

### Traefik

`certFile` takes the full chain, in the dynamic configuration:

```yaml
tls:
  certificates:
    - certFile: /etc/ssl/example.com/fullchain.pem
      keyFile: /etc/ssl/example.com/privkey.pem
```

Traefik does not stop on a bad file. With the intermediate first, Traefik
2.11 to 3.7 logged `private key does not match public key`, kept running and
served its own `TRAEFIK DEFAULT CERT` instead. WebSec0 then reports a hostname
mismatch and caps the grade at T. Check the Traefik logs after each
certificate change.

## Check the result

Reload the server, then list the certificates it sends. Run this with
OpenSSL 3 and replace `example.com` with your host:

```sh
openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | grep -E '^ *[0-9]+ s:|^ +i:'
```

Your certificate is `0` and the intermediates follow from `1`. For
letsencrypt.org in November 2026, the first lines were:

```text
 0 s:CN=letsencrypt.org
   i:C=US, O=Let's Encrypt, CN=YE2
 1 s:C=US, O=Let's Encrypt, CN=YE2
   i:C=US, O=ISRG, CN=Root YE
```

If only line `0` appears, the chain is incomplete. Then check that a client
that does not repair chains accepts it:

```sh
curl -sS -o /dev/null https://example.com/ && echo "chain OK"
```

It prints `chain OK`, or `unable to get local issuer certificate` with exit
code 60 while the intermediate is missing. In the WebSec0 report, the TLS tab
then shows the certificate as trusted, with every certificate your server
sends in the chain. Your TLS grade has other
caps: the [TLS 1.0 and 1.1 guide for Nginx](/guides/tls-versions/nginx/) and
the [TLS cipher suites guide](/guides/tls-ciphers/) cover them.

## Frequently asked questions

### What is an intermediate certificate?

A certificate authority does not sign your certificate with its root key. It signs it with an intermediate certificate, which the root signed. Clients only store the roots, so your server must send the intermediate to connect your certificate to a trusted root.

### Why does my site work in the browser but fail with curl?

Browsers often repair an incomplete chain. They keep intermediates they have seen on other sites, and Firefox ships every intermediate disclosed to the CCADB. curl, OpenSSL and Go programs only use the certificates your server sends, so they stop with "unable to get local issuer certificate".

### Should the chain file include the root certificate?

No. Clients must already trust the root, and RFC 8446 lets the server omit it. In our tests, a chain with the root still validated in WebSec0; it only adds bytes to every handshake.

### Does the order of certificates in the chain file matter?

Your certificate must come first: with the intermediate first, the private key no longer matches and the server refuses to start, or, on Traefik, falls back to its default certificate. After the first one, WebSec0 and OpenSSL 3 accepted the other certificates in any order in our tests, but keep each one followed by its issuer.

### Is SSLCertificateChainFile still supported in Apache?

It is deprecated since Apache 2.4.8, when SSLCertificateFile started to accept the intermediates in the same file. It still worked on 2.4.58, 2.4.62 and 2.4.69 in our tests. Use a full chain in SSLCertificateFile instead.

### Why does WebSec0 show T instead of B for a missing intermediate?

WebSec0 grades B only when it can complete the chain itself, from the URL in your certificate's Authority Information Access extension. If that URL is missing, unreachable or serves a PKCS#7 bundle, the chain does not validate and the grade is T.

## Sources

- [RFC 5280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile, section 4.2.2.1](https://www.rfc-editor.org/rfc/rfc5280.html#section-4.2.2.1), IETF
- [RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3, section 4.4.2](https://www.rfc-editor.org/rfc/rfc8446.html#section-4.4.2), IETF
- [Preloading Intermediate CA Certificates into Firefox](https://blog.mozilla.org/security/2020/11/13/preloading-intermediate-ca-certificates-into-firefox/), Mozilla
- [Configuring HTTPS servers: SSL certificate chains](https://nginx.org/en/docs/http/configuring_https_servers.html#chains), nginx.org
- [Apache Module mod_ssl: SSLCertificateFile and SSLCertificateChainFile](https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslcertificatefile), The Apache Software Foundation
- [Certbot user guide: where are my certificates?](https://eff-certbot.readthedocs.io/en/stable/using.html#where-are-my-certificates), Electronic Frontier Foundation
- [Caddyfile directive: tls](https://caddyserver.com/docs/caddyfile/directives/tls), Caddy
- [Traefik TLS certificates](https://doc.traefik.io/traefik/reference/routing-configuration/http/tls/tls-certificates/), Traefik Labs
