What it means: The certificate is trusted, but it is not issued for the host name or IP your code connected to.
servername when connecting by IPFree online tool — SSL certificate checker: instant results, no signup.
Runs a full TLS check: handshake, protocol versions, certificate chain, trust and expiry.
Node.js raises ERR_TLS_CERT_ALTNAME_INVALID from tls.checkServerIdentity(), after the chain has already been verified. The message format is fixed in the Node.js source (lib/tls.js, lib/internal/errors.js):
Hostname/IP does not match certificate's altnames: Host: api.example.com. is not in the cert's altnames: DNS:www.example.com, DNS:example.comHostname/IP does not match certificate's altnames: IP: 203.0.113.10 is not in the cert's list: — you connected by IP and the certificate has no matching IP-address entry (an empty list means none at all).Host: api.example.com. is not cert's CN: ... — the certificate has no DNS names in subjectAltName, so Node fell back to the Common Name, and that did not match either.Cert does not contain a DNS name — there is nothing to compare against.The dot after the host name in the message is part of Node's format, not a typo in your URL. The error object also carries reason, host and cert properties, so you can log exactly which names the server presented.
| You connect to | Certificate covers | Result |
|---|---|---|
https://203.0.113.10/ | DNS:api.example.com | Fails: an IP needs an IP-address SAN |
https://api (a Docker or Kubernetes service name) | DNS:api.example.com | Fails: short names are different names |
https://example.com/ | DNS:*.example.com | Fails: a wildcard does not cover the bare domain |
https://a.b.example.com/ | DNS:*.example.com | Fails: a wildcard covers exactly one label |
https://api.example.com/ via the wrong IP | Another site's certificate | Fails: DNS or SNI sent you to a different virtual host |
Node's matcher follows RFC 6125 strictly. It compares label by label, allows one * only in the left-most label, rejects patterns with two labels or fewer (no *.com), and does not expand a wildcard inside a punycode (xn--) label. The Common Name is consulted only when the certificate has no DNS names at all, which is rare for public certificates today.
Node checks the name in servername if you set it, otherwise host (lib/internal/tls/wrap.js). That is why connecting to an IP address while the certificate is issued for a name always fails unless you pass the name separately.
node -e "
const tls = require('tls');
const s = tls.connect({host: 'api.example.com', port: 443, servername: 'api.example.com'}, () => {
console.log(s.getPeerCertificate().subjectaltname); s.end();
});
s.on('error', e => console.log(e.code, e.reason));"The same check from the shell, with the same SNI:
openssl s_client -connect api.example.com:443 -servername api.example.com </dev/null 2>/dev/null \
| openssl x509 -noout -ext subjectAltNameIf the names printed are for a different site, the request reached the wrong server: compare dig +short api.example.com with the address your code uses, and check whether a proxy or load balancer default certificate is answering.
servername:https.get({host: '203.0.113.10', servername: 'api.example.com',
headers: {Host: 'api.example.com'}, path: '/health'}, res => {
console.log(res.statusCode);
});example.com or a.b.example.com explicitly next to *.example.com when you reissue.checkServerIdentity with a function that returns undefined, and do not set rejectUnauthorized: false. Both accept a certificate for any other domain signed by any trusted CA.node -e "require('https').get('https://api.example.com/', r => console.log(r.statusCode)).on('error', e => console.log(e.code, e.reason))"
# 200
openssl s_client -connect api.example.com:443 -servername api.example.com -verify_hostname api.example.com </dev/null 2>/dev/null | grep 'Verify return code'
# Verify return code: 0 (ok)The SSL/TLS checker lists the names on the certificate your server presents, so you can see whether the host you call is covered before you change code.
SSL/TLS is the encryption protocol that protects data between the browser and server. Our tool analyzes the certificate, chain of trust, TLS version, and knownvulnerabilities.
Issuer, validity period, signature algorithm, covered domains (SAN), and validation type (DV/OV/EV).
Full chain verification: from leaf certificate through intermediates to root CA.
Protocol version (TLS 1.2/1.3), cipher suites, Perfect Forward Secrecy (PFS) support.
Set up a monitor — get Telegram and email alerts 30/14/7 days before expiration.
SSL certificate monitoring
TLS config audit
HTTPS as ranking factor
customer trust
www and subdomains.Strict-Transport-Security header forces browsers to always use HTTPS.SSL certificate monitoring, check history and alerts 30 days before expiry.
Sign up freeThe certificate lists host names, not your IP, and Node checks the host you connected to. Pass the real name as servername, or use a certificate with an IP-address SAN.
No. A wildcard matches exactly one label, so it covers api.example.com but neither example.com nor a.b.example.com. List those names separately.
Not with a function that always succeeds: then any trusted certificate for any domain is accepted. Override it only to add stricter checks, such as pinning, and call tls.checkServerIdentity first.
It is part of the message format in Node.js source: Host: name. is not in the cert's altnames. It does not mean your URL has a trailing dot.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.