curl: (51) SSL: no alternative certificate subject name matches target host name 'example.com'
The certificate's names (SANs) don't include the host curl connected to.
no alternative certificate subject name matches target host namecurl: (51) SSL: no alternative certificate subject name matches target host namecurl: (51) SSL: certificate subject name does not match target host nameSSL: certificate subject name 'x' does not match target host name Meaning
Connect with a hostname that is covered by the certificate, or reissue the certificate with the right SANs. Using an IP address fails unless the cert has an IP SAN. Use --resolve host:443:IP to test a specific server with the correct hostname instead of using the IP directly.
Common causes
- Connecting via IP address
- Certificate lacks the hostname in SAN
- DNS pointing at the wrong server
- Default vhost serving another certificate
- www vs non-www mismatch
⚡ Quick fix
curl --resolve example.com:443:203.0.113.5 https://example.com- Reissue the certificate with all hostnames
- Fix DNS and the vhost
server_name
Detailed fix by platform
Linux
curl -vI --resolve example.com:443:203.0.113.5 https://example.com
How to diagnose
- Host — Name used?
- SAN — Contains it?
- Server — Right vhost?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- AH01909: server certificate does NOT include an ID which matches the server name Apache: [ssl:warn] AH01909: example.com:443:0 server certificate does NOT include an ID which matches the server name
- CRYPT_E_NO_REVOCATION_CHECK curl (Windows Schannel): schannel: next InitializeSecurityContext failed: CRYPT_E_NO_REVOCATION_CHECK (0x80092012) - The revocation function was unable to check revocation for the certificate
- curl: (60) SSL certificate problem curl: (60) SSL certificate problem: unable to get local issuer certificate
Most viewed in SSL / TLS
- Challenge failed for domain Let’s Encrypt / Certbot: Challenge failed for domain example.com — Invalid response from http://example.com/.well-known/acme-challenge/x: 404
- no start line OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch)
- NSURLErrorServerCertificateUntrusted (-1202) iOS: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be 'example.com'"
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026