Fix missing IP subject alternative names in Spring Boot RestClient

Published · Updated

Save

When RestClient connects to a literal IP address, the certificate needs an IP address subject alternative name for that address. Trusting the issuing CA and matching the certificate's server identity are separate checks.

Choose the endpoint name

If the certificate has a DNS SAN that identifies the service, call that hostname and make sure it resolves to the intended endpoint. If the application must use an IP address, obtain a certificate issued with that address as an IP SAN. A DNS SAN containing the same characters is a different identifier type.

Separate trust from identity

Inspect the certificate the endpoint actually presents. Confirm the expected subject alternative name and the issuer chain. Add the appropriate CA to the client's approved trust configuration when necessary. That trust change does not resolve a name mismatch.

Retest with verification enabled

Use the same hostname or IP that production uses and test both a valid endpoint and a deliberately mismatched one in a controlled environment. A successful request should require a trusted chain and a matching identity. Keep hostname verification enabled.

References

RFC 9525 service identity

Spring Boot SSL bundles

Discuss this answer