To make curl ignore SSL certificate errors, add -k (long form --insecure): curl -k https://example.com/. curl then accepts an expired, self-signed or wrong-host certificate. The safer fix is --cacert file.pem, which trusts that one certificate and keeps the check for everything else.
We triggered each certificate error on purpose on 20 November 2026, with the curl.exe that ships with Windows 11 (curl 8.22.0, Schannel), against the test hosts of badssl.com, then repeated the commands through QuanticData residential and mobile proxies. Every line of output below is from those runs.
The four certificate errors and what -k does to each
Without -k, curl stops before it sends the request and prints why. With -k, the same URL answers 200.
| Test host | What is wrong | curl without -k | Exit code | With -k |
|---|---|---|---|---|
| expired.badssl.com | Certificate past its end date | SEC_E_CERT_EXPIRED, "The received certificate has expired." | 35 | 200 |
| self-signed.badssl.com | Signed by itself | SEC_E_UNTRUSTED_ROOT | 60 | 200 |
| untrusted-root.badssl.com | Chain ends in an unknown authority | SEC_E_UNTRUSTED_ROOT | 60 | 200 |
| wrong.host.badssl.com | Certificate made for another name | SEC_E_WRONG_PRINCIPAL, "The target principal name is incorrect." | 60 | 200 |
$ curl -sS -o /dev/null -w "%{http_code}\n" https://self-signed.badssl.com/
curl: (60) schannel: SEC_E_UNTRUSTED_ROOT (0x80090325) - The certificate chain was issued by an authority that is not trusted.
More details here: https://curl.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the webpage mentioned above.
000
$ curl -sS -k -o /dev/null -w "%{http_code}\n" https://self-signed.badssl.com/
200
Two exit codes cover these cases on Windows: 60 when curl cannot trust the certificate or its name, 35 when the handshake itself fails, which is how the Windows TLS library reports an expired certificate. Scripts should test the exit code, not grep the message: the text comes from the TLS library curl was built with.
The command, short and long form
-kand--insecureare the same option. Put it anywhere on the line.- It only skips the certificate check. curl still speaks HTTPS to the server; what it drops is the proof of who the server is.
- It does not change anything else: headers, method and output options work as before, so
-k -s -o /dev/null -w "%{http_code}"prints just the status, as in the commands above.
curl -k https://self-signed.badssl.com/
curl --insecure https://expired.badssl.com/
The safer fix: trust one certificate with --cacert
When the server is yours (a test box, a router, an internal tool with a self-signed certificate), give curl that certificate instead of switching the check off. curl then accepts that server and still rejects every other bad certificate. We saved the self-signed certificate with openssl, then pointed curl at it:
echo | openssl s_client -connect self-signed.badssl.com:443 -servername self-signed.badssl.com 2>/dev/null | openssl x509 > self.pem
curl --cacert self.pem -o /dev/null -w "%{http_code}\n" https://self-signed.badssl.com/
200
The same --cacert self.pem worked with the second curl on our PC, the one bundled with Git for Windows (curl 8.21.0), which on its own also stopped with exit 60. For a company's internal authority, point --cacert at the authority's certificate rather than at each server's.
Certificates through a proxy: no -k needed
A forward proxy does not change the certificate question. For an https:// URL, curl asks the proxy for a tunnel (CONNECT) and does TLS with the site through it, so the certificate curl checks is the site's own. We sent a plain HTTPS request, with the check on and no -k, through each of three QuanticData networks:
curl -sS -x http://residentialboson.quanticdata.io:10000 -U "USER-type-residential-country-us-session-fx01-lifetime-30:PASS" -o /dev/null -w "%{http_code} verify=%{ssl_verify_result}\n" https://ipinfo.io/ip
curl -sS -x http://residentialpremium.quanticdata.io:8080 -U "USER-country-de-sid-fx02-ttl-30m:PASS" -o /dev/null -w "%{http_code} verify=%{ssl_verify_result}\n" https://ipinfo.io/ip
curl -sS -x http://mobile.quanticdata.io:8080 -U "USER-country-us-type-mobile-sid-fx03-ttl-30m:PASS" -o /dev/null -w "%{http_code} verify=%{ssl_verify_result}\n" https://ipinfo.io/ip
| Network | ipinfo.io, valid certificate, no -k | self-signed.badssl.com, no -k |
|---|---|---|
| Residential Basic, US | 200, verify=0 | exit 60, the same SEC_E_UNTRUSTED_ROOT line as without a proxy |
| Residential Premium, Germany | 200, verify=0 | exit 60, the same line |
| Mobile, US | 200, verify=0 | exit 60, the same line |
Two things follow. The valid site passed the check through all three networks, so you do not need -k for these requests and should not add it "just in case". And each network showed the bad certificate exactly as a direct connection did: curl checked the site's own certificate. If a certificate error ever appears only behind some other proxy, that proxy is inspecting the traffic; that case has its own guide, CERTIFICATE_VERIFY_FAILED behind a proxy. Gateways, usernames and SOCKS5 are covered in how to use a proxy with curl.
Check the result in a script
When curl runs inside a script or a scheduled job, nobody reads the error line. Two things tell the script what happened: the exit code, and the write-out variable %{ssl_verify_result}, which is 0 when the certificate check passed.
curl -sS -x http://residentialboson.quanticdata.io:10000 -U "USER-...:PASS" -o /dev/null \
-w "%{http_code} verify=%{ssl_verify_result}\n" https://ipinfo.io/ip
200 verify=0
curl -sS -o /dev/null -w "%{http_code}\n" https://self-signed.badssl.com/; echo "exit=$?"
curl: (60) schannel: SEC_E_UNTRUSTED_ROOT (0x80090325) - The certificate chain was issued by an authority that is not trusted.
000
exit=60
Note the 000: when the check fails, no HTTP response exists, so a script that only reads the status code sees 000, not an error page.
A job that treats exit 60 and 35 as "certificate problem, stop and alert" and every other non-zero code as "network problem, retry" keeps the check useful instead of hiding it behind -k.
Turning it on for every command, and why not to
curl reads options from a config file: insecure on a line of its own works like -k. We tested it with -K, which loads a given file:
$ cat curlrc-test
insecure
$ curl -K curlrc-test -o /dev/null -w "%{http_code}\n" https://self-signed.badssl.com/
200
Written into curl's default config file, the same line would apply to every command you run, including the ones that log in, download installers or call payment APIs. Keep insecure out of it; use -k on the one command that needs it, or --cacert.
Windows: curl.exe, the PowerShell alias and two TLS libraries
- In Windows PowerShell, type
curl.exe.curlalone is an alias of Invoke-WebRequest there and has no-k. The guide to proxies in PowerShell shows the alias error. - The Windows curl uses Schannel, the Windows TLS library, so its messages read
SEC_E_...and carry a Windows error number, as in the table above. - A second curl may be on your PATH. Ours had curl 8.21.0 from Git for Windows next to the system one;
curl --versionshows which one runs.
When -k is fine and when it is not
| Situation | Use |
|---|---|
| Your own test server or a device with a self-signed certificate | --cacert with its certificate; -k for a one-off check |
| A public site with an expired certificate you only read | -k on that command |
| Anything with a password, a token, a payment or a download you will run | Never -k: fix the certificate or the trust store |
| Scraping public pages through a proxy | No -k: our valid test site passed the check through all three of our networks |
For collection jobs that need a home or carrier IP, our residential proxies and mobile proxies take the same -x and -U options shown above; there is a Residential Basic free trial to try them. Our MCP server can generate the proxy lines for you.


