My service is configured to https , registred on Eureuka server. when i use @FeignClient(value = "my-service") for example,it is always request serves over http, how to slove it? and i have this server Error : No subject alternative DNS name matching
Comment From: ryanjbaxter
Can you try setting ribbon.IsSecure
? If that doesnt work please provide a sample that reproduces the problem
Comment From: tridipch
There is already some discussion here- https://stackoverflow.com/questions/40853829/springboot-feignclient-with-ssl-p12 For me it was easier not to use the mentioned socket factory but instead something like this-
@Bean
public Client feignClient()
{
Client trustSSLSockets = new Client.Default(getSSLSocketFactory(), new NoopHostnameVerifier());
log.info("feignClient called");
return trustSSLSockets;
}
private SSLSocketFactory getSSLSocketFactory() {
try {
TrustStrategy acceptingTrustStrategy = new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
return true;
}
};
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
return sslContext.getSocketFactory();
} catch (Exception exception) {
//Do something
}
}
Comment From: sergejsvisockis
Can you try setting
ribbon.IsSecure
? If that doesnt work please provide a sample that reproduces the problem
I cannot find ribbon.IsSecure property. It seems that it does not exist anymore. Is it right? I am using Spring Boot 2.1.0 and Spring Cloud Greenwich.M1
Comment From: ryanjbaxter
No it exists
Comment From: sergejsvisockis
If so, in which version of Spring Cloud? Due to in Greenwich.M1 it is not found. I have tried to add other dependencies as well "spring-cloud-starter-netflix-ribbon", "spring-cloud-netflix-ribbon", "spring-cloud-starter-ribbon" but it does not seems to be accessible.
Comment From: spencergibb
@sergeivisotsky just because the property isn't autocompleted by an ide doesn't mean it doesn't exist.
Comment From: sergejsvisockis
@spencergibb Ok thanks!
Comment From: spencergibb
Waiting for OP to provide sample.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Comment From: AnilChandrashekar
I'm facing same issue with Springboot 3.4.1. Feign calls are triggered as 'HTTP' though ribbon.IsSecure is set to true
Appreciate any help.
Comment From: spencergibb
ribbon is long not supported, so that property wouldn't have any effect
Comment From: AnilChandrashekar
Thank you @spencergibb for your response. What is the alternative in place to force feign client to trigger calls as 'https'. ? Appreciate any inputs.
Comment From: spencergibb
Are you using service Discovery?