Skip to content

Commit 66d590c

Browse files
committed
Document disabling protocol upgrade for Apache HC5. Fixes gh-1141.
1 parent 44d7d6b commit 66d590c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

docs/modules/ROOT/pages/spring-cloud-openfeign.adoc

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,25 @@ When it comes to the Apache HttpClient 5-backed Feign clients, it's enough to en
146146
You can customize the HTTP client used by providing a bean of either `org.apache.hc.client5.http.impl.classic.CloseableHttpClient` when using Apache HC5.
147147

148148
You can further customise http clients by setting values in the `spring.cloud.openfeign.httpclient.xxx` properties. The ones prefixed just with `httpclient` will work for all the clients, the ones prefixed with `httpclient.hc5` to Apache HttpClient 5, the ones prefixed with `httpclient.okhttp` to OkHttpClient and the ones prefixed with `httpclient.http2` to Http2Client. You can find a full list of properties you can customise in the appendix.
149-
If you can not configure Apache HttpClient 5 by using properties, there is an `HttpClientBuilderCustomizer` interface for programmatic configuration.
149+
If you can not configure Apache HttpClient 5 by using properties, there is an `HttpClient5FeignConfiguration.HttpClientBuilderCustomizer` interface for programmatic configuration.
150+
151+
TIP: Apache HTTP Components `5.4` have changed defaults in the HttpClient relating to HTTP/1.1 TLS upgrades. Most proxy servers handle upgrades without issue, however, you may encounter issues with Envoy or Istio. If you need to restore previous behaviour, you can use `HttpClient5FeignConfiguration.HttpClientBuilderCustomizer` to do it, as shown in the example below.
152+
153+
[source,java,indent=0]
154+
----
155+
@Configuration
156+
public class FooConfiguration {
157+
158+
@Bean
159+
public HttpClient5FeignConfiguration.HttpClientBuilderCustomizer httpClientBuilder() {
160+
return (httpClientBuilder) -> {
161+
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom();
162+
requestConfigBuilder.setProtocolUpgradeEnabled(false);
163+
httpClientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());
164+
};
165+
}
166+
}
167+
----
150168

151169
TIP: Starting with Spring Cloud OpenFeign 4, the Feign Apache HttpClient 4 is no longer supported. We suggest using Apache HttpClient 5 instead.
152170

0 commit comments

Comments
 (0)