CertNudge

Guides

Incomplete certificate chain: unable to get local issuer certificate

Why curl and apps fail while the browser works, how to see the chain a server sends, and how to fix it in nginx and Apache.

2 min read · Updated November 2026

The site works in your browser, but curl, Python, Java or an Android app says unable to get local issuer certificate. That almost always means the server sends its own certificate without the intermediate.

Why browsers don't notice

A certificate is signed by an intermediate, and the intermediate by a root. Clients only trust roots, so the server has to send its certificate and the intermediate together. Chrome and Safari fetch a missing intermediate on their own, and Firefox ships a list of known ones. curl, OpenSSL, Python, Go, Java and most apps don't. So the site looks fine until an API client, a webhook sender or a phone app tries to connect.

Check what the server sends

echo | openssl s_client -connect example.com:443 -servername example.com -showcerts 2>/dev/null \
  | grep -E 's:|i:|Verify return code'

A good server shows at least two certificates (0 s: and 1 s:) and ends with Verify return code: 0 (ok). A broken one shows only 0 s: and one of these:

Verify return code: 21 (unable to verify the first certificate)
Verify return code: 20 (unable to get local issuer certificate)

Fix it

Point the server at the file that has the whole chain. With certbot that's fullchain.pem, not cert.pem.

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

# Apache 2.4.8 and later
SSLCertificateFile    /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

If your certificate came from a commercial CA, they send the intermediate as a separate file (often ca-bundle.crt). Put your certificate first and the intermediate after it:

cat example.com.crt ca-bundle.crt > example.com-fullchain.crt

Reload the server and run the openssl check again. Don't put the root in the file: clients have it already.

Don't fix it on the client

Turning off verification (curl -k, verify=False) or adding the intermediate to one client's trust store makes the error go away for you only. Every other client still fails. Fix the server.

Catching it early

A chain usually breaks right after someone installs a new certificate by hand. A check that verifies the chain the way curl does will flag it on the next run. CertNudge does full verification on every check, so a missing intermediate shows up as an error.