How can I support HTTP proxies using Spring 5 WebClient?

I am using Spring 5 WebClient. I want to know if it can be configured to use an HTTP proxy, or if there is a way to change its default configuration to do this.

+4
source share
1 answer

This is what the base client library should support.

When using Reactor Netty, you can do something like:

ReactorClientHttpConnector connector = new ReactorClientHttpConnector(options -> options
    .httpProxy(addressSpec -> {
        return addressSpec.host("proxyhost"); // or any other method on addressSpec
    }));
WebClient client = WebClient.builder().clientConnector(connector).build();
+6
source

Source: https://habr.com/ru/post/1688311/


All Articles