Skip to content
ecdsa.com
Java (JSSE HostnameChecker)Java

Error message

No subject alternative names matching IP address 127.0.0.1 found

Also printed as

  • java.security.cert.CertificateException: No subject alternative names matching IP address 127.0.0.1 found

The address is the one from your URL; JDK 21 and later prefix the exception text with "(certificate_unknown) ". For DNS host names the message is "No subject alternative DNS name matching <host> found."

Java (JSSE HostnameChecker) — URL host is an IP address that is not an IP SAN of the certificate

What it means

The URL's host is an IP address, and the certificate has no IP-address entry in its Subject Alternative Name extension that equals it. Java (per RFC 6125) compares IP addresses only with IP SAN entries; DNS names and the Common Name never match an address.

Why it happens

How to fix it

  1. 1.

    Connect by a DNS name the certificate lists

    Use the host name and resolve it to the needed address; hostname verification then succeeds.

    bash
    # Use the DNS name from the certificate; map it to the IP where needed
    echo "10.0.0.5 api.example.com" | sudo tee -a /etc/hosts
    curl -sI https://api.example.com/
  2. 2.

    Issue the certificate with an IP SAN

    When clients must use the address, add it as an IP entry (public CAs rarely issue these; private CAs can).

    bash
    # Or issue the certificate with the IP address as an IP SAN entry
    openssl req -new -key server.key -out server.csr -subj "/CN=api.example.com" \
      -addext "subjectAltName=DNS:api.example.com,IP:10.0.0.5"
    keytool -certreq -alias server -keystore server.p12 -ext "SAN=dns:api.example.com,ip:10.0.0.5" -file server.csr

Related errors

Browse the full signature error database