Proxy settings via system properties not working with Spring WebClient #887
Comments
|
Only this is supported (system properties are not supported)
You can easily add/remove proxy configuration using the system properties in your code. |
|
@violetagg just curious, do we ever see the system properties to be pulled in by reactor-netty or do you expect frameworks like spring's webclientbuilder to expose this? |
|
@nhomble I would say no. It's not customary to check System properties in the Spring Framework. Typically external properties from different sources (environment, properties file, etc) are injected into classes that can then configure things accordingly. |
|
I totally agree @rstoyanchev the properties wouldn't come directly from system properties. I was thinking reactor-netty could consider using the system properties directly but integration with spring should rely on configuration properties. I have this working in my project with the config prop approach, but I wanted to make sure I am not duplicating any enhancements either reactor or spring would consider taking in. |
|
@nhomble I prefer to have only an explicit configuration using the API instead of system properties to avoid mixture of priorities .... or should it be a choice between those two configurations or a merge of those two? |
|
Great points @violetagg. For (1) I think the client builder could support both styles and to avoid the merging/ambiguity problem the builder could either take the config as-is in For (2), I think we can continue to be flexible by not assuming system properties are a source of configuration. My current application just provides a proxy consumer that loads the env vars manually which I figure would belong in the library. I also imagine this would help teams like mine migrate easier |
I like the idea and will reopen the issue. So if somebody wants can provide a PR. |
|
@violetagg thanks - do you have any thoughts around reconciling the http and https settings? The proxy enum only has http. Similar to the socket enums, should we introduce a new enum for https? Then I think it's clean to call the systemProperties method on the builder for that type. |
|
@nhomble Netty provides only one type of |
I am using spring webflux latest and the reactor netty as well.But its not using Proxy |
|
@kmariappan2016 You mean that proxy functionality is not working? |
Yes. I have configured the proxy like the following and still its not taking the proxy.
Its not redirecting via proxy server. I am using the following library I am not sure if I am missing anything |
|
@kmariappan2016 Create this as a separate issue and let's investigate there. Ok? |
Create a new issue,seems that any version above spring-security-oauth2-client:5.3.0.RELEASE is bypassing proxy server settings. |
|
https://projectreactor.io/docs/netty/release/api/index.html?deprecated-list.html states: Can you please provider an example? Similar to
|
|
@nagyzsolthun Everything that you was able to configure via
|
Hi,
httpClient = HttpClient.create() Am getting the below error: Description: Field context in com.db.ct.cdh.util.security.WebSecurityConfiguration$X509Endpoints required a bean of type 'javax.servlet.http.HttpServletRequest' that could not be found. The injection point has the following annotations: Action: Consider defining a bean of type 'javax.servlet.http.HttpServletRequest' in your configuration. Please suggest. |
This is not related to Reactor Netty |
|
in my case connection seems to be not getting established between my local system/WebClient to the remote proxy server. underlying Code snippet : final ReactorClientHttpConnector connector = new ReactorClientHttpConnector( HttpClient.create() .tcpConfiguration( tcpClient -> tcpClient.proxy( proxy -> proxy .type(ProxyProvider.Proxy.HTTP) .host("abc-proxy.uk.xyz.abcintra.net") .port(3128) ) ) );
|
|
@agarwaljayant7 For issues please open a new issue, for questions please use Gitter |
|
ok, tx! |
|
Hi, everyone! Thank you for all information here! I'm working with RestTemplate right now and works fine connected in a VPN which is System Proxied. So I don't need to configure anything about the existence of the proxy to make the Spring Boot working. I was using OAuth2RestTemplate but after upgrading to Spring Boot 2.4.4 it is marked as deprecated. But see, I had to write my own CustomPasswordOAuth2AuthorizedClientProvider facing all pain to handle with private methods final classes to simple get a 'Id_token' value that I can get with two lines of code with OAuth2RestTemplate. So, Why they deprecated a top dependency when actually makes sense to deprecated the main feature to not cut someone else legs? Why not just keep the OAuth2RestTemplate for the ones that are not importing Webflux yet cause they architecture are not async yet? I miss the concept of @Legacy instead of @deprecated. And in my case, I don't want to be forced to pass my password to a http proxy because WebClient needs... So, I faced issues with WebClient and Java 8 if the system has a system proxy and using Java 11 I could workaround configuring it before the application startup. But unfortunately, I had to remove 11 because some reactor ran in the test with Java 11 instead of 8 which is the version of my target source and source compatibility configuration and IntellJ configuration. Now, I rolled back to RestTemplate until we have this problem resolved. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.


My following WebClient is working fine with internet connection but not through our proxy connection.
Event though, the same client is working through proxy, if I set it as mentioned below,
But if I set the same Proxy details either using
System.setProperty("http.proxyHost","ourproxy.com");System.setProperty("http.proxyPort","8080");or JVM run-time arguments-Dhttp.proxyHost=ourproxy.com -Dhttp.proxyPort=8080The calls are getting failed with
UnknownHostExceptionlike,Please help, why my code is not functioning even I set the proxy details via JVM run-time arguments or system properties.
Actually I want to avoid code level proxy setting. So please guide me to correct my code or approach, so that I can use JVM run-time argument option.
The text was updated successfully, but these errors were encountered: