SSL certificate problem: unable to get local issuer certificate
"Unable to get local issuer certificate" means the client could not find the issuer of a certificate in its trust store or in the certificates the server sent. Either the server sends an incomplete chain, or the client lacks the CA, as happens behind corporate proxies. Fix the chain, not the verification.
- OpenSSL chain building found no issuer for a certificate in the chain.
- Server side: send the leaf certificate followed by its intermediates.
- Never use curl -k or disable verification in production. curl documents it as unsafe.
Server problem or client problem?
| Test | Result | Meaning |
|---|---|---|
| Browser or SSL checker on the public name | Reports incomplete chain | Fix the server certificate file |
| Same URL from another machine or network | Works there | Client CA store or a proxy on this machine or network |
| Only your tool fails (curl, Python, build agent) | Browsers work | That tool uses its own, outdated or missing CA bundle |
Based on curl's SSL certificate documentation and the OpenSSL verification options.
How do you fix it?
- 01
Check what the server sends
Run openssl s_client -showcerts. Count the certificates. A leaf alone, with no intermediate, is an incomplete chain.
- 02
Serve leaf then intermediates
In nginx, put them in one ssl_certificate file with the primary certificate first. Reload the server.
- 03
Give the client a current CA bundle
curl verifies against a CA store. Point it with --cacert for one transfer or CURL_CA_BUNDLE, SSL_CERT_FILE or SSL_CERT_DIR as defaults.
- 04
Handle a corporate proxy
If a proxy re-signs traffic, add your organization's root CA to the tool's trust store, with the administrator's approval.
- 05
Retest without -k
curl strongly advises never skipping verification in production. If it works only with -k, the underlying problem remains.
Which commands fix or reveal it?
# See the chain the server really sends
openssl s_client -connect example.com:443 -servername example.com -showcerts
# Use a specific CA file for one request
curl --cacert /path/to/ca-bundle.pem https://example.com/
# Default CA file for curl in this shell
export CURL_CA_BUNDLE=/path/to/ca-bundle.pemWhy -k is not a fix
Skipping verification turns the connection into one that accepts any certificate, including an attacker's. It is acceptable only for a throwaway local test. Fix the chain or the CA store instead.
What should you verify after the fix?
- curl works with no -k or --insecure flag anywhere in scripts and configs
- openssl s_client shows more than one certificate when an intermediate is required
- CI runners, containers and build agents have a current CA bundle in their image
- Corporate proxy root CAs are added only to tools that need them
- Scheduled jobs that call HTTPS APIs ran once successfully after the change
- The fix lives in configuration or the image, not in one engineer's shell profile
Common questions
What does unable to get local issuer certificate mean?
The verifier could not locate the certificate that issued one in the chain, either in its trust store or among the certificates the server sent. OpenSSL reports this as chain building failing to find an issuer.
How do I fix unable to get local issuer certificate in curl?
Serve the full chain from the server if it is missing, or point curl at a valid CA bundle with --cacert or CURL_CA_BUNDLE. On Windows with Schannel, curl uses the OS certificates by default.
Is it safe to disable certificate verification?
Not in production. curl's documentation strongly recommends against skipping verification, because the connection then accepts any certificate. Use it only for local experiments, and fix the CA setup for anything real.
Why does it work in the browser but not in my script?
Browsers ship their own trust stores and can complete a chain; your script or runtime may use a different, outdated or empty CA bundle. Test the same URL with curl --cacert or openssl s_client to see which side lacks the issuer.
Does adding the intermediate to the client fix it?
It can, but the better fix is on the server. A server should send its intermediate certificates so every client can build the chain. Adding the intermediate to one client hides the problem for that client while every other client keeps failing.
Keep reading
Watch your domains automatically
Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.