Search code examples
springspring-cloudspring-cloud-netflixnetflix-feignspring-cloud-feign

LoadBalancerFeignClient and SSLSocketFactory


If I want to use a custom SSLSocketFactory for the Feign client (e.g. TrustingAllSSLSocketFactory) do I need to override the LoadBalancerFeignClient bean or it can be achieved via a configuration. For example Ribbon has ribbon.CustomSSLSocketFactoryClassName=com.netflix.http4.ssl.AcceptAllSocketFactory .


Solution

  • LoadBalancerFeignClient is a wrapper around a standard feign.Client. If you are using Apache or Ok Http it is enough to make a custom HttpClient or okhttp3.OkHttpClient bean respectively. If you are using the default create a bean of new feign.Client.Default(SSLSocketFactory, HostnameVerifier).