Certificate Chains: Why a Site Opens in the Browser and Fails in curl

Management Summary
Website certificates are digital identity credentials that let an application check whether a protected connection reaches the intended site. Trust may depend on a chain of issuers, and different programs can recognise different authorities. This explains how a website can open in a browser but fail in an automated service such as curl, a command-line transfer tool. The article explains these differences and why switching identity checks off hides the problem instead of restoring a trustworthy connection.
Contents
A browser opening a website while curl rejects it is a useful symptom, but not a diagnosis. Missing intermediate certificates are one possible cause. Different trust stores, TLS libraries, network routes, proxy settings or validation rules can produce the same contrast.

The transmitted list and the trusted path
The leaf certificate identifies the website. A trust store contains certificates that the client already accepts as trusted. The server presents its leaf certificate and normally the intermediate certificates needed to reach a trusted issuer. A client builds and validates a path using that material and its own trust configuration. The transmitted list and the validated path are therefore not necessarily identical.
A root can be sent, but sending it does not create trust. TLS 1.3 permits omission of a trust-anchor certificate. Conversely, one transmitted certificate is not universal proof of a missing intermediate: direct issuance by a trusted root is possible. Several certificates are not proof of a valid path either.
Why clients can disagree
Some validation systems obtain missing issuers from an Authority Information Access (AIA) URL or reuse locally available intermediates. Availability, network access and policy matter. Windows documents configurable AIA retrieval; curl can use Windows Schannel, Apple trust services or file-based stores depending on the build. The rule “browsers fetch, curl never does” is too broad.
A useful comparison records the exact hostname, resolved address, client version, TLS backend and CA configuration. A proxy can present a different certificate. A browser success does not establish that another application’s trust store or policies will accept the endpoint.
Certificate files and renewal
Certbot uses cert.pem for the leaf, chain.pem for intermediates and fullchain.pem for their combination. The server’s documentation decides which setting receives which file; these are Certbot conventions, not universal CA filenames.
Correct renewal files still need correct deployment. A service using copied files or not reloading can continue serving an old chain. After renewal, the actual endpoint needs checking alongside the files on disk. No evidence establishes that one particular file mistake is the most common TLS fault.
Inspection and verification as separate checks
openssl s_client -connect example.com:443 -servername example.com \
-showcerts -verify_hostname example.com -verify_return_error < /dev/null
curl -vI https://example.com/
-showcerts displays the server-sent certificates. -servername supplies SNI, telling the server which hostname is requested; -verify_hostname performs the separate name check. -verify_return_error makes a verification failure abort instead of merely appearing in diagnostic output. A missing CA configuration can itself cause failure. These POSIX-shell examples use the installed default trust configuration and do not perform a complete browser-policy or revocation audit.
The curl command verifies by default and requests HTTP headers. A later HTTP error is distinct from a TLS failure. Disabling verification with -k hides an important check and does not repair the chain.
What was tested here
Ten isolated checks used temporary private certificates and a loopback server. A valid chain and matching name passed. Omitting the intermediate or requesting the wrong name failed verification. Without the strict OpenSSL option, the missing-intermediate test still exited with code zero; with it, the exit code was one. No trust was installed system-wide and no external website was contacted.
The same tests confirmed the example wildcard: *.example.test matched www.example.test, but neither the bare domain nor a.b.example.test. Modern service-identity rules use subject alternative names rather than Common Name fallback. An HTTPS redirect cannot repair a name failure at the initial hostname: TLS happens before that HTTP response.
The historical twelve-site sample
An archived summary dated 2 September 2026 records twelve hosts: six chain counts of three and six of four. It reports 90-day validity for that sample and 31–88 remaining days; the median is 70, while the arithmetic mean is about 61.9. These are historical recorded values, not a fresh measurement or a universal industry lifetime.
The summary contains no original PEM chains or complete handshake logs. The counts cannot independently establish what every server transmitted, and the spread of remaining days does not prove a renewal schedule. Claims about current TLS support or issuer distribution require a new, documented measurement.
Interpreting the toolbox result
The site’s TLS inspector checks the first selected address with verification enabled, then attempts an unverified diagnostic connection only if the first attempt fails. A successful connection permits separate protocol attempts. Results concern that address and the server-side client, not every CDN endpoint or browser.
Its descriptive labels are aids, not definitive root-cause proof: a general verification failure can have several causes. “OCSP” in the certificate metadata indicates an advertised responder, not a successful revocation check. A failed old-protocol attempt may also reflect local restrictions or network failure.
When an endpoint stops working
The comparison covers the actual chain, hostname, validity dates, client clock and trust configuration, plus deployment after renewal, alternate endpoints and proxy changes. Updating a CA store may help when a required trusted root is missing, but counting certificates cannot establish that this is the only remedy.
Questions and answers
Does it help to add the root certificate to the transmitted chain?
No. Trust comes only from the root in the client’s trust store; a root sent along by the server changes nothing about that. If the root is missing from the store, validation still fails, and it is no substitute for a missing intermediate. The extra certificate only makes every handshake larger.
Why is the exit code of openssl s_client not enough in a monitoring script?
Because without -verify_return_error, s_client only reports a verification error and completes the connection anyway. In the test, the case with a missing intermediate therefore ended with exit code zero; only with the option was it one. A script that evaluates only the exit code needs this option or has to read the printed “Verify return code” line.
Even then, the script checks only the installed trust configuration of its own machine. The name needs -verify_hostname as well, no revocation check takes place, and success says nothing about how clients with other trust stores decide.
After a renewal, only some clients report a chain error. Where is the search worth starting?
When only some clients fail, the difference lies either in the endpoint they reach or in their own validation. These places are worth comparing:
- Several endpoints. One hostname can stand for several addresses, load balancers or CDN nodes. If the new files were not deployed everywhere or the service was not reloaded everywhere, part of them still serves the old chain. Each resolved address therefore needs its own check.
- The wrong file. If the server configuration receives only the leaf certificate (cert.pem with Certbot) where it expects the combination (fullchain.pem), the intermediate is missing. Clients that fetch missing issuers or have them available locally do not notice; others fail.
- A proxy. A proxy on the path of individual clients can present a different certificate.
- The client itself. An outdated trust store, a different TLS library or a wrong clock cause errors that have nothing to do with the server’s chain.
Each finding needs the hostname, resolved address, client version, TLS library and CA configuration in the record; only a comparison of two complete entries shows where the difference lies.
Why does a redirect from the bare domain to www not help when the certificate only covers www?
Because the client validates the certificate before it receives any HTTP response at all. If the name check fails for the bare domain, the redirect never arrives. A wildcard such as *.example.test does not help either, because it does not cover the bare domain; what is needed is a certificate whose Subject Alternative Names include both names.


