I have am calling another API using WebClient. I have a cert that is being used by API that has a hostname X. However, if I want to make https calls to the API using a different url from the certificate, I correctly get an error.
The problem is that I will be using a docker network and dockers service discovery to call the API. This means that I know the cert is valid, I know the names will mismatch (docker url and cert url) and the client should accept that.
I’ve tried the following and that doesn’t work
.secure { sslSpec: SslProvider.SslContextSpec ->
sslSpec
.sslContext(SslContextBuilder.forClient()
.build())
.serverNames(SNIHostName("docker-network-url"))
.build()
}
I know disabling host name check is also an option but that’s more insecure in general and bad practice.
Is there a way I can validate the cert name and accept it even if the url is different?
You need to sign in to view this answers
Leave feedback about this