Skip to content

Commit

Permalink
BE: Respect system proxy settings in WebClient (#4042)
Browse files Browse the repository at this point in the history
  • Loading branch information
Khrol authored Jul 24, 2023
1 parent a32272d commit ca2d53f
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
public class WebClientConfigurator {

private final WebClient.Builder builder = WebClient.builder();
private HttpClient httpClient = HttpClient
.create()
.proxyWithSystemProperties();

public WebClientConfigurator() {
configureObjectMapper(defaultOM());
Expand Down Expand Up @@ -90,12 +93,7 @@ private WebClientConfigurator configureSsl(
// Create webclient
SslContext context = contextBuilder.build();

var httpClient = HttpClient
.create()
.secure(t -> t.sslContext(context))
.proxyWithSystemProperties();

builder.clientConnector(new ReactorClientHttpConnector(httpClient));
httpClient = httpClient.secure(t -> t.sslContext(context));
return this;
}

Expand Down Expand Up @@ -131,6 +129,6 @@ public WebClientConfigurator configureCodecs(Consumer<ClientCodecConfigurer> con
}

public WebClient build() {
return builder.build();
return builder.clientConnector(new ReactorClientHttpConnector(httpClient)).build();
}
}

0 comments on commit ca2d53f

Please sign in to comment.