---
title: "SSL certificate verify failed: fix it in Python, curl and Node"
description: "Certificate verify failed means your code did not trust a certificate, often your proxy's. How to fix it in Python, curl, Node and Chrome, safely."
url: "https://scrapenews.com/errors/ssl-certificate-verify-failed"
updated: "2026-11-26T00:00:00Z"
---

# SSL certificate verify failed: fix it in Python, curl and Node

Proxy errors · CERTIFICATE_VERIFY_FAILED

Published 26 Nov 2026

What you see

- `[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate`
- `SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)'))`
- `requests.exceptions.SSLError`
- `certificate verify failed: self-signed certificate in certificate chain`

**More error strings (10)**

- `curl: (60) SSL certificate problem: unable to get local issuer certificate`
- `SSL certificate problem: self-signed certificate in certificate chain`
- `CURLE_PEER_FAILED_VERIFICATION`
- `Error: unable to verify the first certificate`
- `UNABLE_TO_VERIFY_LEAF_SIGNATURE`
- `SELF_SIGNED_CERT_IN_CHAIN`
- `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`
- `DEPTH_ZERO_SELF_SIGNED_CERT`
- `CERT_HAS_EXPIRED`
- `net::ERR_CERT_AUTHORITY_INVALID`

## What it means

Your code asked for an HTTPS page and got back a certificate (the site’s ID card) it did not trust. It hung up before sending your request. When you scrape, the certificate is often not the site’s at all: your proxy or unblocker made it up to read your traffic. The fix is almost always the same: **trust the right CA file instead of switching the check off**.

## Why it happens

A certificate is trusted when a CA (a certificate authority, the company that vouches for it) in your trust list signed it. The check fails when that chain breaks somewhere. Most common first:

1. **Your proxy opens your HTTPS traffic.** Unblocker APIs in proxy mode decrypt each request to work on it, then sign the page with their own CA. That CA is a stranger to your code:
   - **Bright Data** (residential, Web Unlocker, SERP API in native proxy mode) gives you its CA file. The one in use is `brightdata_root_ca_44445.crt` for port `44445`. The old ones for ports 22225 and 33335 expired on 25 Sep 2026, 00:00 UTC, and traffic that still needs them fails.
   - **Zyte API**: Zyte says that if every request fails with a certificate error, you need to install its CA.
   - **Oxylabs Web Unblocker** asks you to skip the check (`-k` in curl or the same thing in your language).
   - **mitmproxy** and other debugging proxies make a fake certificate for every site, all signed by their own CA.
2. **Your code uses a different trust list than your computer.** requests uses the `certifi` package. Python from python.org on macOS does not read the Keychain. Node uses its own bundled CAs. A CA you installed system-wide can work in Chrome and still fail in your code.
3. **The site sends half its chain.** Most certificates hang off a middle (“intermediate”) certificate. Browsers can fetch a missing one on their own. Python and Node cannot, so you get `unable to get local issuer certificate` or `unable to verify the first certificate`.
4. **The site’s certificate is just bad.** It is self-signed, expired, or made for a different hostname. A wrong clock on your machine can make a good one look expired too.

The check starts with what the site sends: its own certificate plus the middle ones. Your client walks up that chain until it reaches a root it already trusts. No trusted root at the top means the check fails.

A proxy that reads your HTTPS has to stand in for the site. It fetches the page, then hands it to you under a certificate it made on the spot. It cannot sign as the real site, so it signs with its own CA. mitmproxy’s docs describe the same thing: a dummy certificate for every site you visit, trusted only after you install its CA.

To your code, that looks like an attack. Chromium’s notes list “an attacker” first among the reasons for this error. The difference is that you asked for it.

The browser-only trick: browsers can follow a link inside the certificate (AIA, “Authority Information Access”) to fetch a missing intermediate certificate. A CPython developer called that slow and not something to rely on. So the site works in Chrome and still fails in your scraper.

## Fix it

1. **Read the reason after the colon.** `self-signed certificate in certificate chain` behind a proxy usually means cause 1. The table further down matches each reason to its cause.
2. **Test the same URL with curl and then without the proxy.** If it works without the proxy, the proxy is the one signing. If curl works and your code fails, look at your code’s trust list (cause 2).
3. **Behind an unblocker or debugging proxy, trust its CA file:**
   - Python requests: put the vendor’s CA after a normal CA bundle in one file and then set `REQUESTS_CA_BUNDLE` to it.
   - Node: start it using `NODE_EXTRA_CA_CERTS=/path/vendor-ca.crt`.
   - curl: add `--cacert /path/vendor-ca.crt`.
   - Chrome, Firefox or a tool that cannot load a file: install the CA in the system’s trusted root store. Bright Data and Zyte both list the clicks per OS.
4. **CA already on your system (corporate network, local root CA)?** Tell your tool to use the system store:
   - Python 3.10+: the `truststore` library.
   - Node 23.8.0+: `--use-system-ca` (or `NODE_USE_SYSTEM_CA=1` from 22.19.0 and 24.6.0).
   - curl: `--ca-native`.
5. **Python from python.org on macOS failing everywhere?** Run `Install Certificates.command` from your Python folder first.
6. **The site’s own chain is incomplete?** Add the missing intermediate to your CA file.
7. **Turn the check off only where the vendor makes you.** `verify=False`, `curl -k` and `NODE_TLS_REJECT_UNAUTHORIZED=0` accept any certificate at all, so scope it to that one proxy call, never your whole program.

Why the CA file beats switching the check off: `verify=False` drops every check at once. Wrong host, expired, signed by anyone: all accepted. With the vendor’s CA loaded, your code still refuses a certificate that vendor did not issue, and every other check keeps running.

Where the file goes: on the machine that runs the scraper. Bright Data’s docs point out that on a cloud server, the server is the one that needs it, not your laptop. In most code you just load the file per call, with no install at all.

If you must turn it off, keep it small. In Python, `verify=False` sits on one call. In Node, `NODE_TLS_REJECT_UNAUTHORIZED=0` turns off checks for TLS connections in the whole process. `rejectUnauthorized: false` goes in the options of one connection instead. Oxylabs’ Node sample sets the process-wide one.

Our advice: a new IP or a retry won’t help here. The same CA signs every answer from the same service, so just fix the trust list once.

Paste this into your AI

```
My scraper fails with this certificate error:
"<paste the full error line, including the text after 'certificate verify failed:' or the error code>"
Explain in plain words which certificate failed: the website's, my proxy's, or one a proxy made up in the middle.
List the likely causes in order, most likely first. For each, give one quick test and one fix.
Prefer fixes that keep verification on (trusting a CA file) over turning it off.
Show the curl -v command that tests the same URL through my proxy.
My setup: <Python requests / httpx / Node fetch / axios / curl / Playwright / Puppeteer> on <OS>,
proxy: <none / provider + product, e.g. unblocker API in proxy mode / company proxy / mitmproxy>,
CA settings: <default / REQUESTS_CA_BUNDLE / NODE_EXTRA_CA_CERTS / --cacert / verify=False>,
target URL pattern: <https://example.com/...>.
Never ask me to paste my real password.
```

## Dev details

### The reason text tells you the cause

| reason (OpenSSL text) | Node `err.code` | usual cause when scraping |
| --- | --- | --- |
| `self-signed certificate in certificate chain` | `SELF_SIGNED_CERT_IN_CHAIN` | proxy or unblocker signing with its own CA |
| `unable to get local issuer certificate` | `UNABLE_TO_GET_ISSUER_CERT_LOCALLY` | your trust list is missing a CA (proxy’s, company’s, or a middle certificate) |
| `unable to verify the first certificate` | `UNABLE_TO_VERIFY_LEAF_SIGNATURE` | the site sent only its own certificate, no chain |
| `self-signed certificate` | `DEPTH_ZERO_SELF_SIGNED_CERT` | the site signed its own certificate |
| `certificate has expired` | `CERT_HAS_EXPIRED` | expired certificate, or your clock is wrong |
| `hostname mismatch` | `HOSTNAME_MISMATCH` | certificate made for another name |

OpenSSL’s own docs:

- `unable to get local issuer certificate`: “the list of trusted certificates is not complete”.
- `self-signed certificate in certificate chain`: the chain was built, but no trusted root was found.
- `unable to verify the first certificate`: the chain holds only one certificate, it is not self-signed and partial chains are not allowed.

### Real messages

```text
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))

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

Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1496:34)
    ...
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}
```

### curl (error 60)

`60` means `CURLE_PEER_FAILED_VERIFICATION`: “The remote server’s SSL certificate or SSH fingerprint was deemed not OK.” curl prints `SSL certificate problem: <reason>`, points to `https://curl.se/docs/sslcerts.html` and says “curl failed to verify the legitimacy of the server and therefore …”.

```bash
# Bright Data native proxy mode, CA loaded per call
curl --proxy brd.superproxy.io:44445 \
  --proxy-user brd-customer-<account-id>-zone-<zone-name>:<zone-password> \
  --cacert /path/brightdata_root_ca_44445.crt "https://geo.brdtest.com/mygeo.json"

# mitmproxy
curl --proxy 127.0.0.1:8080 --cacert ~/.mitmproxy/mitmproxy-ca-cert.pem https://example.com/

# certificates the server actually sends
curl -w %{certs} https://example.com > cacert.pem
```

- `--cacert` and `-k` act on the site’s certificate. For TLS to an `https://` proxy itself, curl uses `--proxy-cacert` and `--proxy-insecure`.
- `CURL_CA_BUNDLE`, `SSL_CERT_FILE` and `SSL_CERT_DIR` also point curl at a CA file when it has no native store.
- Apple SecTrust builds: `--cacert` alone means just that file is trusted. Use `--ca-native --cacert file` for both.
- Windows Schannel builds use the Windows store. Bright Data says if curl on Windows fails on port 44445 with `CRYPT_E_REVOCATION_OFFLINE`, add `--ssl-revoke-best-effort`.
- curl’s advice on `-k`: avoid it and “never skip verification in production”.

### Python requests

```bash
# cacert.pem = the Mozilla CA bundle from curl's "CA Extract" page
cat cacert.pem vendor-ca.crt > ca-bundle.pem
export REQUESTS_CA_BUNDLE="$PWD/ca-bundle.pem"   # CURL_CA_BUNDLE is the fallback
```

Zyte’s advice is to append the vendor CA to a generic bundle.

```python
import requests
requests.get("https://example.com", proxies=proxies, verify="/path/ca-bundle.pem")
```

- `verify=` takes a CA bundle file, or a folder processed by OpenSSL’s `c_rehash`.
- Prepared requests (`s.send(prepped)`) ignore environment settings, so `REQUESTS_CA_BUNDLE` is skipped and you get `CERTIFICATE_VERIFY_FAILED`. Merge them in: `settings = s.merge_environment_settings(prepped.url, {}, None, None, None)`, then `s.send(prepped, **settings)`.
- `verify=False` makes requests accept any certificate and ignore hostname mismatches and expired certificates.
- One report: a custom `ssl_context` adapter that loaded Windows system CAs worked on requests 2.31.1 and failed on 2.32.x. The reporter ties it to 2.32.0, where `verify=True` began reusing one global SSL context.
- Python’s `ssl` module needs the server to send the full chain, and a CPython issue asking for browser-style fetching of missing middle certificates has been open since 1 Aug 2013.

```python
import truststore
truststore.inject_into_ssl()   # Python 3.10+; as early as possible; apps only, not libraries
import requests
```

More about proxies and `SSLError` in Python: [Python requests ProxyError](https://scrapenews.com/errors/python-requests-proxyerror.md).

### Node.js

```bash
NODE_EXTRA_CA_CERTS=/path/vendor-ca.crt node scraper.js
node --use-system-ca scraper.js
```

- `NODE_EXTRA_CA_CERTS` adds PEM certificates to Node’s built-in roots. It is read once at startup, so setting `process.env.NODE_EXTRA_CA_CERTS` in code has no effect.
- Passing a `ca` option to a TLS or HTTPS client drops both the built-in and the extra certificates.
- On errors like `UNABLE_TO_VERIFY_LEAF_SIGNATURE`, Node adds a hint to try `--use-system-ca` if the root CA is installed locally.
- `rejectUnauthorized: false` or `NODE_TLS_REJECT_UNAUTHORIZED=0` turn the check off. Node’s docs call the variable “strongly discouraged”. Oxylabs’ Node sample sets it from inside the script.

### Browsers: ERR_CERT_AUTHORITY_INVALID

Chromium error `-202` means a certificate was signed by an authority it does not trust. Its own notes give 3 options: an attacker, a real CA Chrome doesn’t know, or a self-signed certificate. Through an unblocker, it is the second.

```js
// Playwright
const context = await browser.newContext({ ignoreHTTPSErrors: true });
// Puppeteer
const browser = await puppeteer.launch({ acceptInsecureCerts: true });
```

Or install the vendor’s CA in your system or browser store, following what Bright Data and Zyte describe, and keep the check on.

### Vendor CA cheat sheet

| service | what its docs say |
| --- | --- |
| Bright Data, native proxy mode | load `brightdata_root_ca_44445.crt` per call (`--cacert`) or install it; port `44445`; can skip it via the proxy API or after KYC |
| Zyte API, proxy mode | install the Zyte CA; Node: `NODE_EXTRA_CA_CERTS`; requests: CA bundle + `REQUESTS_CA_BUNDLE`; Java: `keytool` truststore |
| Oxylabs Web Unblocker (`unblock.oxylabs.io:60000`) | ignore the certificate: `curl -k`, `verify=False`, `NODE_TLS_REJECT_UNAUTHORIZED = 0` |
| mitmproxy | trust `~/.mitmproxy/mitmproxy-ca-cert.pem`, or install it from `mitm.it` |

Why the same words show up in Python, Node.js and curl: all three hand the check to OpenSSL (curl when built with it). Node’s docs say `err.code` holds the OpenSSL error code. curl prints OpenSSL’s text after `SSL certificate problem:`. Python’s message carries the same text after `certificate verify failed:`. That is why one table covers all three.

curl numbers changed once: since curl 7.62.0, `CURLE_PEER_FAILED_VERIFICATION` and `CURLE_SSL_CACERT` are one error, 60. Before that, a failed peer check was reported as 51.

Error 77 is a different problem: `CURLE_SSL_CACERT_BADFILE`, “Problem with reading the SSL CA cert (path? access rights?)”. Your CA file never loaded. So check the path and permissions first, before you look at the server.

## Questions

### Why does the site open fine in my browser but fail in Python?

Two common reasons. Your code may use its own list of trusted CAs, not your computer's: requests uses the certifi package, and Node uses its bundled list unless you pass --use-system-ca. Or the site leaves out a middle certificate: browsers can download it themselves, Python's ssl module needs the server to send the full chain.

### Is verify=False safe with an unblocker API?

It makes your code accept any certificate, expired or for the wrong host. The requests docs say that leaves you open to man-in-the-middle attacks. Oxylabs Web Unblocker asks you to skip the check. Bright Data and Zyte give you their CA file instead, so the check can stay on.

### Do I need Bright Data's SSL certificate?

Only in native proxy mode. Bright Data says you can work without it through its proxy API, or once your account passes its KYC check. With it, use brightdata_root_ca_44445.crt on port 44445: the old certificates for ports 22225 and 33335 expired on 25 Sep 2026.

## Related

- [Python web scraping](https://scrapenews.com/guides/python-requests-beautifulsoup.md)  (Guide)
- [Scrape a JavaScript website with Playwright, and when not to](https://scrapenews.com/guides/scrape-javascript-sites-playwright.md)  (Guide)
- [Rotating proxies](https://scrapenews.com/guides/rotating-proxies.md)  (Guide)
- [Scraper and unblocker APIs](https://scrapenews.com/compare/scraper-apis.md)  (Compare)
- [Proxy checker](https://scrapenews.com/proxy-checker.md)  (Free tool)
- [407 Proxy Authentication Required](https://scrapenews.com/errors/407-proxy-authentication-required.md)  (Error)

## Tools that get past it

| Tool | Price |
| --- | --- |
| [Bright Data](https://scrapenews.com/compare/bright-data.md): Bright Data Residential Proxies: Rotating residential proxy pool from Bright Data with country, state, city and ZIP targeting. Billed per GB, pay as you go or monthly. Bright Data Web Unlocker: Unblocking API from Bright Data: you send a URL, it handles proxies, retries and CAPTCHAs. Billed per 1,000 requests. · Residential Proxies **$8.00/GB** Web Unlocker **$1.50/1k req** | $8.00/GB |
| [Oxylabs Web Unblocker](https://scrapenews.com/compare/oxylabs.md): Oxylabs proxy-style endpoint that handles blocks for you, billed per GB of traffic. | $7.20/GB |
| [Playwright](https://scrapenews.com/compare/playwright.md): Microsoft's framework to drive Chromium, Firefox and WebKit from code with one API. Made for testing; also used to scrape. | Free |
| [Puppeteer](https://scrapenews.com/compare/puppeteer.md): JavaScript library to control Chrome and Firefox from code. | Free |
| [Requests](https://scrapenews.com/compare/requests.md): The classic simple HTTP library for Python. | Free |
| [Zyte API](https://scrapenews.com/compare/zyte-api.md): Zyte's scraping API: prices each site by difficulty tier, with or without browser rendering. Pay as you go or monthly commitment. | $0.13/1k req |

## Sources

1. [curl docs: TLS Certificate Verification (--cacert, --ca-native, -k, HTTPS proxy)](https://curl.se/docs/sslcerts.html) curl.se
2. [libcurl: error codes (CURLE_PEER_FAILED_VERIFICATION, 60)](https://curl.se/libcurl/c/libcurl-errors.html) curl.se
3. [curl source: vtls/openssl.c ('SSL certificate problem: %s')](https://github.com/curl/curl/blob/master/lib/vtls/openssl.c) github.com
4. [curl source: tool_operate.c (error 60 help text)](https://github.com/curl/curl/blob/master/src/tool_operate.c) github.com
5. [Stack Overflow: curl: (60) SSL certificate problem: unable to get local issuer certificate](https://stackoverflow.com/questions/24611640) stackoverflow.com
6. [OpenSSL docs: certificate verify error codes and strings](https://docs.openssl.org/3.0/man3/X509_STORE_CTX_get_error/) docs.openssl.org
7. [Requests docs: SSL Cert Verification, CA Certificates (certifi), prepared requests](https://requests.readthedocs.io/en/latest/user/advanced/) requests.readthedocs.io
8. [psf/requests issue #6717: SSLCertVerificationError with a local root CA on 2.32.x](https://github.com/psf/requests/issues/6717) github.com
9. [CPython issue #62817: AIA chasing for missing intermediate certificates](https://github.com/python/cpython/issues/62817) github.com
10. [Truststore docs: system certificate stores for Python 3.10+](https://truststore.readthedocs.io/en/latest/) truststore.readthedocs.io
11. [Node.js docs: TLS, X509 certificate error codes, rejectUnauthorized](https://nodejs.org/api/tls.html) nodejs.org
12. [Node.js docs: NODE_EXTRA_CA_CERTS, --use-system-ca, NODE_USE_SYSTEM_CA, NODE_TLS_REJECT_UNAUTHORIZED](https://nodejs.org/api/cli.html) nodejs.org
13. [nodejs/node issue #33705: UNABLE_TO_VERIFY_LEAF_SIGNATURE caused by a missing chain](https://github.com/nodejs/node/issues/33705) github.com
14. [Chromium source: net_error_list.h (CERT_AUTHORITY_INVALID, -202)](https://chromium.googlesource.com/chromium/src/+/HEAD/net/base/net_error_list.h) chromium.googlesource.com
15. [Playwright docs: Browser, ignoreHTTPSErrors](https://playwright.dev/docs/api/class-browser) playwright.dev
16. [Puppeteer docs: ConnectOptions, acceptInsecureCerts](https://pptr.dev/api/puppeteer.connectoptions) pptr.dev
17. [Puppeteer docs: LaunchOptions (extends ConnectOptions)](https://pptr.dev/api/puppeteer.launchoptions) pptr.dev
18. [Bright Data Docs: SSL certificate (port 44445, old ports expired 25 Sep 2026)](https://docs.brightdata.com/general/account/ssl-certificate) docs.brightdata.com
19. [Zyte docs: Installing the Zyte CA certificate](https://docs.zyte.com/misc/ca.html) docs.zyte.com
20. [Oxylabs Docs: Web Unblocker (ignore the SSL certificate)](https://developers.oxylabs.io/products/web-unblocker) developers.oxylabs.io
21. [Oxylabs Docs: Web Unblocker, Making Requests (code samples)](https://developers.oxylabs.io/products/web-unblocker/making-requests) developers.oxylabs.io
22. [mitmproxy docs: About Certificates](https://docs.mitmproxy.org/stable/concepts/certificates/) docs.mitmproxy.org

## Up

- [Home](https://scrapenews.com/index.md)
- [Errors & CAPTCHAs](https://scrapenews.com/errors.md)
