The short answer

A server proves its identity with a leaf certificate for its name, plus the intermediate certificates that link it to a root the client already trusts. The client checks every signature in that chain, that the leaf names the host it asked for, and that nothing has expired. The most common fault is a server that sends only the leaf: browsers often repair the gap on their own, but curl, API clients, mobile apps and mail servers fail with "unable to get local issuer certificate". Fix it by installing the full chain (leaf plus intermediates) on every server and address that answers for the name, then test with openssl s_client.

Leaf, intermediate and root

CertificateIssued toWhere it comes from
Leaf (end-entity)Your names, such as example.com and www.example.comSent by your server, issued by an intermediate
IntermediateThe CA's issuing certificateSent by your server, after the leaf. There may be more than one.
RootThe CA itself (self-signed)Already in the client's trust store. The server does not need to send it.

The client builds a path from the leaf, through the intermediates, to a root it trusts, and checks:

  • each certificate's signature against the next one up;
  • that today's date is within every certificate's validity period;
  • that the leaf's Subject Alternative Name list contains the host name it asked for (the old Common Name field is ignored by modern clients);
  • that the leaf is allowed for server authentication, and, where the client checks, that it has not been revoked.

Common chain problems

ProblemTypical errorFix
Missing intermediate"unable to get local issuer certificate" or "unable to verify the first certificate"; works in some browsers onlyInstall the full chain file the CA provides (often called fullchain.pem)
Wrong or old intermediateThe same errors, or failures only on older devicesUse the chain the CA currently issues with your certificate, not one saved years ago
Name not on the certificate"hostname mismatch" or ERR_CERT_COMMON_NAME_INVALIDReissue with every name visitors use, such as both the apex and www. A wildcard covers one level only: *.example.com covers www.example.com but not example.com or a.b.example.com.
Expired leaf"certificate has expired"Renew and reload the server; automate renewal
Wrong certificate for the nameA certificate for another site, or a default oneThe server did not match the SNI name to the right site; add the name to the site's configuration
Self-signed or private CA"self-signed certificate in certificate chain"Use a publicly trusted certificate for public sites; install the private root on managed clients only
Client clock wrong"certificate is not yet valid" on one deviceFix the device's time
Corporate TLS inspectionThe issuer is a company proxy, not a public CAExpected on that network; test from outside it

SNI and servers that share an address

Many sites share one IP address. The client sends the name it wants in the TLS handshake (Server Name Indication, SNI), and the server picks the matching certificate. If the name is not configured, the server sends its default certificate, which is the wrong one. Always pass the name when testing (-servername in openssl), or you test the default site instead of yours.

Behind a load balancer or CDN, every server and every address must be fixed, including IPv6. A chain fixed on one of four servers fails for a quarter of visitors.

Checking the chain with openssl and curl

CommandWhat it shows
openssl s_client -connect www.example.com:443 -servername www.example.com -showcerts </dev/nullEvery certificate the server sends, in order, and a final Verify return code. 0 means the chain is good.
openssl s_client -connect www.example.com:443 -servername www.example.com -verify_hostname www.example.com </dev/nullAlso checks the name; code 62 means hostname mismatch
openssl s_client -connect www.example.com:443 -servername www.example.com </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates -ext subjectAltNameThe leaf's names, issuer and validity dates (OpenSSL 3)
openssl s_client -connect 192.0.2.10:443 -servername www.example.com </dev/nullOne specific server, bypassing DNS
openssl verify -untrusted chain.pem leaf.pemWhether a chain file you are about to install is correct
curl -vI https://www.example.com/The handshake as a non-browser client sees it, which does not repair missing intermediates
curl.exe -vI https://www.example.com/The same from Windows PowerShell
Verify return codeMeaning
0OK
10Certificate has expired
18 or 19Self-signed certificate, or a self-signed root in the chain that the client does not trust
20 or 21Unable to get the issuer, or to verify the first certificate: usually a missing intermediate
62Hostname mismatch (with -verify_hostname)

Fixing it and confirming the fix

  1. Get the right chain from your CA or ACME client. Certbot and most ACME clients write a fullchain.pem.
  2. Point the server at it. On nginx, ssl_certificate takes the full chain. On Apache 2.4.8 and later, SSLCertificateFile takes the leaf followed by the intermediates. On IIS and Windows, import the intermediate into the Intermediate Certification Authorities store. On a CDN or load balancer, upload the chain there.
  3. Reload the service so it reads the new files.
  4. Test every address with the openssl commands above, and once more from outside your network, for example with an online TLS test.
  5. Automate renewal and alert on expiry well ahead of time.

TLS problem or DNS problem?

What you seeLayer
"Server not found", NXDOMAIN, SERVFAIL or a lookup timeoutDNS: the browser never reached a server. See why a domain is not resolving.
A certificate warning that names another site or a hosting providerUsually DNS pointing at the wrong server (an old address, or a CDN that does not know your name yet), which then sends its own certificate
Expired, untrusted issuer or missing intermediateTLS, on the server that answered
Works on one network, fails on anotherEither: compare the IP each network resolves, then the certificate each IP sends

So check DNS first: confirm the name resolves to the server you expect (dig +short www.example.com), then check the certificate that server sends.

How DNS Panopticon helps

Security Posture checks whether a domain's homepage loads over HTTPS and redirects plain http to it, and its TLS and Certificates card reads CAA and DANE records. Website Recon shows the domain's current certificate from Certificate Transparency logs, with its issuer and dates. The TLS Chain Checker reads the chain your server actually sends during the handshake and explains each problem, and the TLS Configuration Checker also tests its protocol versions and cipher suites (see TLS protocols and cipher suites).

FAQ

Why does my site work in Chrome but fail in curl or an app?

Most likely the server is missing an intermediate certificate. Some browsers fetch or remember missing intermediates on their own; curl, many API clients and apps do not. Install the full chain.

Should the server send the root certificate?

It does not need to. Clients already have the root in their trust store. Sending it does no harm beyond a few extra bytes.

Does a wildcard certificate cover the bare domain?

No. A certificate for *.example.com covers names one level below, such as www.example.com, but not example.com itself. Add example.com as a separate name on the same certificate.

Can DNS cause a certificate error?

Yes, indirectly. If the name resolves to the wrong server, that server sends its own certificate, which does not match your name. Check where the name resolves before changing certificates.

Why are check times shown in UTC?

The TLS Chain Checker shows when it checked the server in Coordinated Universal Time (UTC), the same clock certificates use for their validity dates, so a colleague looking at the same result sees the same time. Hover over the time to see it in your own time zone.

Sources and further reading