I am curious as to how the following code returns a HTTP-200 correct response
WebClient.builder().build()
.get()
.uri("https://www.google.com")
.retrieve()
.toEntity(String.class)
.block();
where I have not configured the SSL context, and I am accessing a secured site.
However, when I do the same with the following URIs,
I get,
Fatal (CERTIFICATE_UNKNOWN): PKIX path building failed: sun
.security.provider.certpath.SunCertPathBuilderException: unable to find valid
certification path to requested target
Is there a default truststore that spring-webclient is using?
CodePudding user response:
If SSL context is not provided, it will look for certificate in Java's default truststore($JAVA_HOME/lib/security/cacerts
) and if it doesn't find it there, it will throw exception