跳到主要内容

NET::ERR_CERT_AUTHORITY_INVALID

NET::ERR_CERT_AUTHORITY_INVALID is Chrome’s verdict that it could not build a trusted path from the certificate your server presented up to a root CA in its trust store. It is almost never a server outage, a firewall rule, or a broken private key — it is a chain problem. In practice, roughly four out of five cases are a server that sends only the leaf certificate and forgets the intermediate. The rest are self-signed certificates, private CAs the client has never heard of, or a corporate TLS-inspection proxy that re-signs traffic on the fly.

This guide gives you a five-command diagnostic, per-server fixes for nginx, Apache, HAProxy, Node and cloud load balancers, a symptom-to-fix comparison table, and a decoder for the real error strings you will meet in curl, Java, Python, Node, Go and Docker.

1. What NET::ERR_CERT_AUTHORITY_INVALID Actually Means

Chrome’s network stack returns ERR_CERT_AUTHORITY_INVALID when verification fails at the path building stage: the leaf certificate’s issuer cannot be chained up to a trusted root. The message is deliberately generic — it covers self-signed leaves, missing intermediates and unknown private roots alike, which is why you need a diagnostic before you touch any config.

Neighbouring errors mean something different, and mixing them up wastes hours:

  • NET::ERR_CERT_COMMON_NAME_INVALID — the chain is fine; the hostname does not match the SAN list.
  • NET::ERR_CERT_DATE_INVALID — expired, not yet valid, or the client clock is wrong.
  • NET::ERR_CERT_REVOKED — the issuing CA revoked the certificate.
  • NET::ERR_SSL_PROTOCOL_ERROR — the handshake failed before any certificate was judged (protocol or cipher mismatch, plain HTTP served on port 443).

The same underlying failure wears a different name in every client. Learn the aliases:

Client Error string
Chrome / Edge / Android WebView NET::ERR_CERT_AUTHORITY_INVALID
Firefox SEC_ERROR_UNKNOWN_ISSUER, or MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT
Safari / iOS This Connection Is Not Private (errSSLXCertChainInvalid, CFNetwork -1203)
curl curl: (60) SSL certificate problem: unable to get local issuer certificate
OpenSSL Verify return code: 20 (unable to get local issuer certificate)
Java / Tomcat PKIX path building failed ... unable to find valid certification path to requested target
Python requests CERTIFICATE_VERIFY_FAILED ... unable to get local issuer certificate
Node.js unable to verify the first certificate (UNABLE_TO_VERIFY_LEAF_SIGNATURE)
Go / Docker x509: certificate signed by unknown authority
.NET AuthenticationException: The remote certificate is invalid according to the validation procedure

2. How the Browser Validates a Chain (60-Second Version)

Four things have to line up before the padlock appears:

  1. The trust store. Chrome uses the operating system store on Windows and macOS, and the Chrome Root Store on ChromeOS, Linux and Android; recent Chrome versions also use the Chrome Root Store alongside OS roots on Windows and macOS. Firefox ships its own NSS store. curl reads /etc/ssl/certs/ca-certificates.crt on Debian/Ubuntu or /etc/pki/tls/certs/ca-bundle.crt on RHEL-family systems. Java reads $JAVA_HOME/lib/security/cacerts.
  2. The server sends the right set. Leaf first, then every intermediate in order, and never the root.
  3. Path building. The client walks leaf → intermediate → root, checking the signature at each step plus basicConstraints CA:TRUE on issuers, key usage, validity dates and name constraints.
  4. Hostname and revocation. SAN matching and a best-effort OCSP/CRL check run only after the path is built.

Browsers sometimes attempt to fetch a missing intermediate from the caIssuers URL in the AIA extension, but that behaviour is inconsistent across platforms, frequently blocked by firewalls and proxies, and cannot be relied on. The rule is simple: the server must send the complete chain.

3. Diagnostic Playbook: Five Commands That Pinpoint the Cause

Run these from any Linux or macOS box before changing a single line of configuration. The -servername flag supplies SNI and is mandatory on shared hosting.

Command 1 — dump the chain the server actually sends

openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null

A healthy response contains a Certificate chain block with at least two entries and ends with Verify return code: 0 (ok):

Certificate chain
 0 s:CN = example.com
   i:C=US, O = Let's Encrypt, CN = R11
 1 s:C=US, O = Let's Encrypt, CN = R11
   i:C=US, O = Internet Security Research Group, CN = ISRG Root X1
---
Verify return code: 0 (ok)

A broken one looks like this — one entry, and a non-zero verify code:

Certificate chain
 0 s:CN = example.com
   i:C=US, O = Let's Encrypt, CN = R11
---
Verify return code: 21 (unable to verify the first certificate)

Command 2 — verify code and depth only

echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | grep -E "^depth|Verify return code"

Command 3 — count certificates in the chain

openssl s_client -connect example.com:443 -servername example.com -showcerts </dev/null 2>/dev/null | grep -c "BEGIN CERTIFICATE"

A result of 1 means the server is sending the leaf only. That is your bug — unless the leaf was issued directly by a root, which is rare for public CAs and common for enterprise CAs.

Command 4 — verify against a known-good bundle

openssl s_client -connect example.com:443 -servername example.com 
  -CAfile /etc/ssl/certs/ca-certificates.crt </dev/null 2>/dev/null | grep "Verify return code"

If this returns 0 (ok) but the browser still fails, the problem is on the client side: stale root store, a proxy, or certificate pinning. If it returns 21 or 20, the server’s chain is short.

Command 5 — identify who is actually signing

openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null 
  | openssl x509 -noout -subject -issuer -dates -ext authorityInfoAccess

If the issuer is Zscaler, Fortinet, Palo Alto, Blue Coat or your own Corp Proxy CA, you are behind TLS inspection — see section 6.

Two useful extras:

curl -vI https://example.com 2>&1 | grep -iE "SSL certificate|subject:|issuer:|expire"
# compare SNI vs no-SNI: a mismatch means the default vhost is serving the wrong cert
openssl s_client -connect 203.0.113.10:443 </dev/null 2>/dev/null | openssl x509 -noout -subject
openssl s_client -connect 203.0.113.10:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -subject

4. Fix #1 — Incomplete Chain: Deploying fullchain.pem Correctly

This is the dominant cause. Your CA issued you several files and you deployed the wrong one. Know what each file contains:

File Contents Deploy to server? Notes
cert.pem / leaf Leaf certificate only No (except with a separate chain directive) The single most common cause of ERR_CERT_AUTHORITY_INVALID
chain.pem / intermediate Intermediate certificate(s) Only where a separate chain directive exists Apache < 2.4.8 SSLCertificateChainFile
fullchain.pem Leaf + intermediate(s), leaf first Yes Correct for nginx, Apache 2.4.8+, HAProxy, ALB, CloudFront
root.crt Root certificate Never Clients must already trust it; sending it can trigger verify error 19
privkey.pem Private key Yes, via the key directive Keep permissions at 600 and owner root

nginx

server {
    listen 443 ssl;
    server_name example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
}
nginx -t && systemctl reload nginx

The classic mistake here is ssl_certificate .../cert.pem. Note that ssl_trusted_certificate is for OCSP stapling and client verification — it does not replace fullchain.pem.

Apache httpd

SSLCertificateFile    /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
apachectl configtest && systemctl reload apache2

On Apache 2.4.7 and older, split it: SSLCertificateFile takes the leaf and SSLCertificateChainFile takes the intermediates. When concatenating manually, the leaf must come first.

HAProxy

HAProxy wants one PEM containing certificate, chain and key, in that order:

cat cert.pem chain.pem privkey.pem > /etc/haproxy/certs/example.com.pem
chmod 600 /etc/haproxy/certs/example.com.pem
bind *:443 ssl crt /etc/haproxy/certs/example.com.pem

Node.js

const https = require('https');
const fs = require('fs');

https.createServer({
  cert: fs.readFileSync('/etc/ssl/example.com/fullchain.pem'),
  key:  fs.readFileSync('/etc/ssl/example.com/privkey.pem')
}, app).listen(443);

Do not confuse cert with ca. The ca option is for validating client certificates, not for serving your chain.

Tomcat / Java keystores

openssl pkcs12 -export -inkey privkey.pem -in fullchain.pem -out example.p12 -name tomcat
keytool -importkeystore -srckeystore example.p12 -srcstoretype PKCS12 
  -destkeystore example.jks -deststoretype JKS

Cloud load balancers

On AWS ALB/NLB, CloudFront, GCP HTTPS LB and Azure Application Gateway, paste leaf + intermediates (no root) into the certificate chain field, leaf first. Verify what was actually stored with:

aws elbv2 describe-listener-certificates --listener-arn arn:aws:elasticloadbalancing:...

Where to get the missing intermediate

openssl x509 -in cert.pem -noout -ext authorityInfoAccess

The caIssuers URL points at the issuing intermediate. Download the .crt or .pem from the CA repository (Let’s Encrypt publishes them at letsencrypt.org/certificates/), or extract it from a known-good host using the same CA.

Post-deploy checklist

  • Verify return code: 0 (ok) from Command 4 above.
  • Chain count is 2 or 3, never 1, and never includes the root.
  • Tested from an external network, not just from the server itself.
  • Tested with curl, a browser, and one non-browser client (Java, Python or Node) that your users actually rely on.
  • Renewal hook re-deploys fullchain.pem, not cert.pem.

5. Fix #2 — Self-Signed and Private CA Certificates

A self-signed certificate is its own root, and its root lives in nobody’s trust store. You have exactly two honest options.

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d example.com -d www.example.com
sudo certbot renew --dry-run

Let’s Encrypt requires a publicly resolvable name plus either HTTP-01 (port 80 reachable) or DNS-01 validation. DNS-01 also covers wildcards and internal-only names as long as you control the DNS provider. Certbot writes fullchain.pem — deploy that file.

Option B — keep the private CA and distribute the root

This is legitimate for intranets, labs and device fleets, but the root must be installed on every client, and the CA must be built correctly (CA:TRUE, keyCertSign, sensible pathlen). A leaf certificate marked CA:FALSE will still fail path building even after you import it, because the client checks the constraint.

# Linux (Debian/Ubuntu)
sudo cp corp-root.crt /usr/local/share/ca-certificates/corp-root.crt
sudo update-ca-certificates

# Linux (RHEL/Fedora)
sudo cp corp-root.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust extract

# Windows (elevated prompt)
certutil -addstore -f Root corp-root.crt

# macOS
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain corp-root.crt

# Java
sudo keytool -importcert -noprompt -trustcacerts -alias corp-root 
  -file corp-root.crt -keystore "$JAVA_HOME/lib/security/cacerts" -storepass changeit

Firefox keeps its own NSS store. Import via Settings → Privacy & Security → Certificates → View Certificates → Authorities → Import, or set security.enterprise_roots.enabled to true in about:config to pull in OS roots.

For local development, use mkcert instead of hand-rolling certificates:

mkcert -install
mkcert example.local localhost 127.0.0.1 ::1

mkcert creates a local root, installs it into the OS and NSS stores, and issues leaf certificates from it — no browser warnings, no --insecure flags in your test scripts.

6. Fix #3 — Corporate TLS Inspection and Client Trust Stores

Tell-tale pattern: the site works from home and fails in the office, or it fails on one machine only, or the certificate viewer shows an issuer you have never heard of.

openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null 
  | openssl x509 -noout -issuer

If that prints issuer=C = US, O = Zscaler Inc., CN = Zscaler Intermediate Root CA (or Fortinet, Palo Alto, Squid, Blue Coat, or your own Corp Proxy CA), a middlebox is terminating TLS and re-signing traffic. Also check the environment:

env | grep -iE "http_proxy|https_proxy|no_proxy|NODE_EXTRA_CA_CERTS|SSL_CERT_FILE|REQUESTS_CA_BUNDLE|CURL_CA_BUNDLE"

Fixes, in order of preference:

  1. Obtain the inspection root from IT and install it in every trust store that needs it (OS, Firefox, JVM, Node, Python, Docker).
  2. Add the host to the SSL-decryption bypass list in the proxy policy.
  3. For clients with certificate pinning (mobile apps, some SDKs, IoT firmware), inspection breaks them regardless of trust — those need a bypass, not another root.

Never teach users to click through the interstitial. That trains them to ignore the one warning that actually protects them.

Per-runtime overrides for development and CI:

export NODE_EXTRA_CA_CERTS=/path/corp-root.crt
export REQUESTS_CA_BUNDLE=/path/corp-root.crt
export SSL_CERT_FILE=/path/corp-root.crt
export CURL_CA_BUNDLE=/path/corp-root.crt

git config --global http.sslCAInfo /path/corp-root.crt
npm config set cafile /path/corp-root.crt

Docker daemon talking to a private registry with a private CA:

sudo mkdir -p /etc/docker/certs.d/registry.example.com:5000
sudo cp corp-root.crt /etc/docker/certs.d/registry.example.com:5000/ca.crt
sudo systemctl restart docker

7. Comparison Table: Matching the Symptom to the Fix

What you see OpenSSL verify code Most likely cause Confirm with Fix
Browser fails on a public site, chain shows one entry 21 (unable to verify the first certificate) Intermediate not sent by the server Command 3 returns 1 Deploy fullchain.pem (section 4)
curl works, browser fails 20 (unable to get local issuer certificate) Client trust store missing the root Command 4 returns 0 Update ca-certificates / install root
Chain shows the root certificate 19 (self-signed certificate in certificate chain) Root included in the bundle Issuer equals subject on the last cert Remove the root from the deployed file
Fresh install, internal hostname 18 (self-signed certificate) Self-signed leaf Issuer equals subject on the leaf Use a public CA, or distribute the private root
Only in the office / only on the VPN 0 (ok) externally, fails internally TLS inspection proxy Command 5 shows a corporate issuer Install the corp root or bypass inspection
Works by hostname, fails by IP 0 (ok) with SNI, fails without SNI-based virtual host serving the default cert Compare Command 5 with and without -servername Add a default server block with a valid cert
Started failing on a date 10 (certificate has expired) Expired leaf or intermediate openssl x509 -noout -dates Renew; automate renewal with a reload hook
Browser fine, Java/Python/Node fail n/a (non-OpenSSL client) Separate trust store, never updated Point the client at an explicit CA bundle Import root into cacerts, set REQUESTS_CA_BUNDLE, NODE_EXTRA_CA_CERTS
App fails, browser on same device fine n/a Certificate pinning, or Android app trust scope Test the same URL in the device browser Update the pin, or use a CA-signed cert that matches it

8. Troubleshooting: Real Error Messages, Decoded

NET::ERR_CERT_AUTHORITY_INVALID — Chrome, Edge, Android WebView

Cause: path building failed. Fix: run Command 1. One certificate in the chain means missing intermediate; a corporate issuer means inspection; issuer equals subject means self-signed.

SEC_ERROR_UNKNOWN_ISSUER — Firefox

Cause: the root is not in Firefox’s NSS store. Firefox does not read the Windows or macOS store by default. Fix: import the root under Authorities, or set security.enterprise_roots.enabled to true.

curl: (60) SSL certificate problem: unable to get local issuer certificate

Cause: curl cannot find the issuer of the last certificate in the chain. Fix: if the server chain is short, fix the server; if only curl fails, update the bundle:

sudo apt install --reinstall ca-certificates && sudo update-ca-certificates
curl --cacert /path/corp-root.crt https://example.com

curl: (60) SSL certificate problem: self signed certificate in certificate chain

Cause: a self-signed root or a private CA appears mid-chain. Fix: trust the root explicitly with --cacert, or replace the certificate with a publicly trusted one.

PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target — Java

Cause: the JVM’s cacerts does not contain the root, or the server omits an intermediate. Fix: confirm the server chain first (Command 3), then import:

keytool -printcert -sslserver example.com:443
sudo keytool -importcert -noprompt -trustcacerts -alias corp-root 
  -file corp-root.crt -keystore "$JAVA_HOME/lib/security/cacerts" -storepass changeit

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007) — Python

Cause: requests/urllib3 is using certifi, which may be older than your corporate root. Fix:

export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
# or, for a private CA
export REQUESTS_CA_BUNDLE=/path/corp-root.crt
python -c "import certifi; print(certifi.where())"

Error: unable to verify the first certificate / UNABLE_TO_VERIFY_LEAF_SIGNATURE — Node.js

Cause: Node bundles its own root list and the server is not sending the intermediate. Fix: deploy fullchain.pem on the server; on the client side, add the root without disabling verification:

export NODE_EXTRA_CA_CERTS=/path/corp-root.crt

Never ship NODE_TLS_REJECT_UNAUTHORIZED=0 to production — it disables verification globally and is a genuine vulnerability.

x509: certificate signed by unknown authority — Go, Docker, Kubernetes

Cause: the Go binary uses the system pool (or a scratch-container empty pool). Fix: install the root into /etc/ssl/certs inside the image, or mount it:

COPY corp-root.crt /usr/local/share/ca-certificates/corp-root.crt
RUN update-ca-certificates

For Docker pulling from a private registry, see the /etc/docker/certs.d/ recipe in section 6.

Verify return code: 21 (unable to verify the first certificate) — OpenSSL

Cause: the chain contains only the leaf. Fix: section 4.

Verify return code: 20 (unable to get local issuer certificate) — OpenSSL

Cause: the top of the chain is an intermediate whose parent root is not in your local store, or the chain stops at an intermediate the CA did not cross-sign. Fix: complete the chain, or pass -CAfile with the correct bundle.

SSL certificate problem: unable to get local issuer certificate — Git

Cause: Git uses its own CA bundle on Windows and macOS. Fix:

git config --global http.sslCAInfo /path/corp-root.crt
# or, on Windows, point at the OS store
git config --global http.sslBackend schannel

SELF_SIGNED_CERT_IN_CHAIN — npm

Cause: the registry sits behind a private CA or inspection proxy. Fix: npm config set cafile /path/corp-root.crt. Avoid npm config set strict-ssl false; it removes the check entirely.

9. FAQ

Is it safe to click Advanced → Proceed?

No. The warning exists precisely because the client cannot tell your server apart from an attacker’s. The only legitimate bypass is a short-lived, local development exception where you control both ends.

Why does the site load in Chrome but fail in Firefox?

Different trust stores. Chrome uses the OS or Chrome Root Store; Firefox uses NSS and ignores OS roots unless security.enterprise_roots.enabled is set. A private or inspection root installed in one will be missing from the other.

Why does it work on my laptop but fail on my phone?

Either the phone lacks the root (very common for private CAs), or the app targets a newer Android API level. Apps targeting API 24 and above ignore user-installed CAs by default and only trust system roots plus their own network security config.

Should I include the root certificate in fullchain.pem?

No. Send leaf plus intermediates only. Including the root bloats the handshake and can produce verify error:num=19:self-signed certificate in certificate chain on some clients.

Does the order of certificates in fullchain.pem matter?

Yes. Leaf first, then each intermediate in the order it chains upward. Some servers and load balancers will fail or serve a partial chain if the order is reversed.

Why did the error appear right after a renewal?

Almost always a deploy step that copies cert.pem instead of fullchain.pem, or a renewed intermediate that was not re-deployed alongside the new leaf. Always reload the web server after renewal and re-run Command 4.

Can I just use a self-signed certificate for internal tools?

Only if you distribute the root to every client, or use a proper internal CA. For developer machines, mkcert does this in two commands. For anything reachable from the internet, use a public CA.

Does HSTS make this worse?

Yes. With HSTS active there is no click-through at all — the browser refuses outright and will not let you bypass. Clear it during development with chrome://net-internals/#hsts → Delete domain security policies.

What about curl -k and --insecure?

Fine for a one-off diagnostic, never in a script, CI pipeline or production client. They disable the exact check you are trying to fix, so a broken chain will silently keep working until it reaches a real user.

How do I stop this from recurring?

Monitor the served chain, not the file on disk. A cron job or synthetic check that runs openssl s_client -connect host:443 -servername host and alerts on any non-zero verify code catches expired intermediates, botched renewals and accidental config reverts before users do.