-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for proxy hosts black listing in ProxyOptions #2600
Comments
is that something you can contribute ? |
I would if had proper time and proper knowledge on how vertx works in the internal. But I was hoping you guys can pull it through. |
ok, i'm keeping this as feature request |
Actually I believe it's more "whitelisting" than "blacklisting" since the noProxy feature of the JVM (and docker network has the same feature) is that everything goes to the proxy except the Edit for references: |
Signed-off-by: KowalczykBartek <[email protected]>
Hi, I crafted something today, new ProxyOptions()
.setType(ProxyType.HTTP)
.exludeHost("localhost") //
.exludeHost("localhost2") //
.setHost("google.com")
.setPort(proxy.getPort()); |
looks good for me! if we can make accept a list of string or something like that it could be better, but just having the behavior is already good! thanks |
the setter should be Look at how other options handle this. |
Signed-off-by: KowalczykBartek <[email protected]>
Signed-off-by: KowalczykBartek <[email protected]>
Signed-off-by: KowalczykBartek <[email protected]>
What with NetClient ? should ProxyOptions include option to exclude SocketAddress ? NetClient connect(SocketAddress remoteAddress, Handler<AsyncResult<NetSocket>> connectHandler); |
that's a concern I had indeed, but ProxyOptions don't support |
can you explain it a little bit ? |
well actually I don't think we need to do that because one can still create 2 net clients if he wants to use domain sockets. so just a plain list of excluded hosts is fine for me, we don't need to address the port. |
Signed-off-by: KowalczykBartek <[email protected]> Signed-off-by: KowalczykBartek <[email protected]>
hmm, so, I guess that I can ask you for review, CountDownLatch a = new CountDownLatch(1);
Vertx v = Vertx.vertx();
ProxyOptions proxyOptions = new ProxyOptions();
proxyOptions.setHost("targethost");
proxyOptions.setPort(8080);
proxyOptions.addExcludedHost("exludedhost1");
proxyOptions.addExcludedHost("exludedhost2");
HttpClient client = v.createHttpClient(new HttpClientOptions()
.setProxyOptions(proxyOptions));
client.getNow(8080,"exludedhost1","/", request -> {
System.out.println(request);
a.countDown();
});
a.await(); and /etc/hosts
P.S As I played with this proxy feature, I noticed that it doesn't work with HTTPS traffic, ProxyChannelProvider do not understand https, generates HTTP request, then this proxied http response is handled by handler(SslHandler) that expects to have SSL record. ProxyOptions proxyOptions = new ProxyOptions();
proxyOptions.setHost("targethost");
proxyOptions.setPort(8080);
proxyOptions.addExcludedHost("exludedhost1");
proxyOptions.addExcludedHost("exludedhost2");
HttpClient client = v.createHttpClient(new HttpClientOptions()
.setSsl(true)
.setTrustAll(true)
.setVerifyHost(false)
.setProxyOptions(proxyOptions)); did I do something wrong ? maybe I can fix this in this branch as well ? |
@KowalczykBartek it is possible to test it using configuration of the Vert.x |
@KowalczykBartek it's not clear what you mean with https. The HttpClient supports HTTPS proxy using the connect method, and the traffic will be encrypted after the proxy issues an CONNECT request to the server. This is explained here https://vertx.io/docs/vertx-core/java/#_using_a_proxy_for_http_https_connections |
I think what you are missing is the
|
the boolean usesProxy is only used for non https proxies that will rewrite the URL for the proxy as a full uri |
ok, so it was my fault, I didn't know about this CONNECT request to create tunnel in case of HTTPS request :/ sorry :) NetSocket clientSocket = result.result();
serverSocket.write("HTTP/1.0 200 Connection established\n\n");
serverSocket.closeHandler(v -> clientSocket.close());
clientSocket.closeHandler(v -> serverSocket.close());
Pump.pump(serverSocket, clientSocket).start();
Pump.pump(clientSocket, serverSocket).start(); |
I'm wondering if we really need this feature, i.e if you don't need proxying then just create another HttpClient / NetClient that does not use a proxy and it should work in a simpler manner |
That is question to @haithkris , i just wanted to make some code :) |
oh right, if you are looking for contributions, we can guide you and assign you tasks |
The goal of the feature seems to handle the Vertx Proxy settings like the JVM does: https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html |
@marcottedan the JVM has a global handling (static), in vertx you can create (lightweight) many different clients with different configurations, so it's fine to create one HttpClient with proxy settings and one HttpClient without proxies and let the application chose the right client |
@vietj do you mean some stuff not present/listed in Issues vert.x tab ? |
@KowalczykBartek I got your mail and will reply to you soon, sorry for the delay |
Hi guys. |
we should review it and merge it I think |
Thanks @vietj . |
@vietj any update on this one? |
it is not yet scheduled to be implemented by the team |
Clients have been modified to filter proxy options based on a list of hosts support. Host declaration accept wildcard match like JVM nonProxyHosts list. HTTP requests declares now a ProxyOptions property that will set the proxy options per request and override the client configuration. fixes #2600 fixes #3795
Clients have been modified to filter proxy options based on a list of hosts support. Host declaration accept wildcard match like JVM nonProxyHosts list. HTTP requests declares now a ProxyOptions property that will set the proxy options per request and override the client configuration. fixes #2600 fixes #3795
Hi Julien, Is there any plans to port this fix to 3.9.x releases? Thank you. |
there are no plans, we only support 3.9.x for bug fixes, sorry
…On Tue, Feb 8, 2022 at 6:22 AM Gurusreekanth ***@***.***> wrote:
Hi Julien,
Is there any plans to port this fix to 3.9.x releases?
Thank you.
—
Reply to this email directly, view it on GitHub
<#2600 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABXDCQX2J5N76PYTEJGGD3U2CSA3ANCNFSM4FRINTHA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Hi, we have this issue when we want to ignore the proxy and when it comes to call certain components of our internal network. Since vertx ignores JVM proxy arguments like
http.nonProxyHosts
there is no real workaround.The proxy configuration is set at the
WebClient
level. ProxyOptions object should have an equivalent tohttp.nonProxyHosts
.Vertx web version: 3.5.1
Vertx core version: 3.5.1
The text was updated successfully, but these errors were encountered: