The site looks fine in a browser but its SSL chain is incomplete
Is this SSL certificate chain broken?Short answer
Browsers often keep intermediate certificates they saw before, so a site without its bundle can look fine in them and still fail for other clients. Check with openssl s_client: if only certificate 0 appears, the bundle is missing. Append the intermediates to the server certificate file.
Fix it fast
1Find out which cause you have
List the certificates the server really sends. A complete setup shows your certificate at depth 0 followed by at least one intermediate.
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null2Match what you see, then jump to its fix
What does the error look like?
Is this SSL certificate chain broken?The site works in a browser but fails in another client or checker
Cause 1 of 2
The intermediate bundle was never added to the certificate file
1Check
Count the BEGIN CERTIFICATE blocks in the file passed to ssl_certificate.
grep -c "BEGIN CERTIFICATE" /etc/nginx/ssl/example.com.crt2Fix
Concatenate your certificate and the bundle your authority sent, certificate first, and use the result in ssl_certificate.
cat example.com.crt bundle.crt > example.com.chained.crt
# in the server block:
# ssl_certificate /etc/nginx/ssl/example.com.chained.crt;
# ssl_certificate_key /etc/nginx/ssl/example.com.key;3Verify
Reload, then run the first-step command again and see more than one certificate.
sudo nginx -t && sudo systemctl reload nginx
openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null | grep -c "BEGIN CERTIFICATE"Confirmed by nginx.org
Cause 2 of 2
OCSP stapling cannot verify the chain
1Check
ssl_trusted_certificate holds the CA certificates used to verify OCSP responses when stapling is enabled; with ssl_stapling_verify the root and the intermediates must be in it.
grep -R -n -E "ssl_stapling|ssl_trusted_certificate" /etc/nginx/2Fix
Add the file with the root and intermediate certificates.
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/nginx/ssl/ca-chain.pem;3Verify
Reload nginx without errors and ask for the stapled response.
sudo nginx -t && sudo systemctl reload nginx
openssl s_client -connect example.com:443 -servername example.com -status </dev/null | grep -i -A3 "OCSP"Confirmed by nginx.org
How do I stop it coming back?
- Test with openssl s_client after every renewal, not only in your own browser.
- Build the chained file by a script, with your certificate first.
- Keep the authority's bundle next to the certificate it came with.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Servers
nginx refuses to start: private key does not match the certificate
SSL: error:05800074:x509 certificate routines::key values mismatch
nginx pairs the private key with the first certificate in the ssl_certificate file.
2 causes, each with a fixServers
A Let's Encrypt certificate did not renew with Certbot
Type: connection ... Timeout during connect (likely firewall problem)
Run sudo certbot renew --dry-run and read the Type and Detail lines.
6 causes, each with a fixServers
curl cannot connect to port 80 or 443 on a server running nginx
CURLE_COULDNT_CONNECT (7): Failed to connect() to host or proxy
Exit code 7 means the TCP connection itself failed, before any HTTP happened.
3 causes, each with a fixServers
Django returns a 500 behind Gunicorn and the traceback is nowhere
The traceback shows locally with runserver but not under Gunicorn
With DEBUG set to False, Django's default logging does not print errors to the console.
2 causes, each with a fixServers
Your website on a Google Compute Engine VM times out on port 80
The site works with curl on the VM but not from outside
A timeout, as opposed to a refusal, usually means a firewall dropped the packets.
3 causes, each with a fixServers
Gunicorn rejects a request with "Error parsing headers: limit request headers fields size"
Error parsing headers: 'limit request headers fields'
Gunicorn caps the size of one header field at 8190 bytes and the number of headers at 100 by default.
2 causes, each with a fix