You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to specify a proxy connection to use to connect to a grpc server?
This is the code that i'm currently using to instanciate the client used for the connection with the server
Preference order of how to configure proxies (the first two are generic Java):
-Dhttps.proxyHost and -Dhttps.proxyPort (and -Dhttp.nonProxyHosts, which is used for both http and https). Java docs. Note that gRPC will observe the https configuration, even when doing plaintext, as it will use the HTTP CONNECT proxing protocol
gRPC's ProxyDetector. This is best suited for libraries that are going to a fixed destination and they know they need a proxy. This happens, but is generally rare
Ok I think that I'm interested in the third case you mentioned, but now how can I use that ProxyDetector class?
Preference order of how to configure proxies (the first two are generic Java):
-Dhttps.proxyHost and -Dhttps.proxyPort (and -Dhttp.nonProxyHosts, which is used for both http and https). Java docs. Note that gRPC will observe the https configuration, even when doing plaintext, as it will use the HTTP CONNECT proxing protocol
gRPC's ProxyDetector. This is best suited for libraries that are going to a fixed destination and they know they need a proxy. This happens, but is generally rare
Did you take a look at the ProxyDetector documentation? Return null if the address (which is generally hostname + port) shouldn't be proxied and otherwise return HttpConnectProxiedSocketAddress.
Activity
[-]How can I use ManagedChannel with a proxy[/-][+]How can I use ManagedChannel with a proxy?[/+]sanjaypujare commentedon Apr 5, 2022
Take a look at https://github.com/grpc/grpc-java/blob/master/api/src/main/java/io/grpc/ProxyDetector.java#L24 and https://github.com/grpc/grpc-java/blob/master/api/src/main/java/io/grpc/ManagedChannelBuilder.java#L522 to understand how proxies work in gRPC.
ejona86 commentedon Apr 6, 2022
Preference order of how to configure proxies (the first two are generic Java):
-Dhttps.proxyHostand-Dhttps.proxyPort(and-Dhttp.nonProxyHosts, which is used for both http and https). Java docs. Note that gRPC will observe the https configuration, even when doing plaintext, as it will use the HTTP CONNECT proxing protocolProxySelector.setDefault(). Use this if you need more complex configuration logicmattiaferrari02 commentedon Apr 12, 2022
Ok I think that I'm interested in the third case you mentioned, but now how can I use that
ProxyDetectorclass?mattiaferrari02 commentedon Apr 12, 2022
Also, is it possible to connect using a SOCKS proxy instead of a HTTP/HTTPS proxy?
ejona86 commentedon Apr 12, 2022
Did you take a look at the ProxyDetector documentation? Return
nullif the address (which is generally hostname + port) shouldn't be proxied and otherwise return HttpConnectProxiedSocketAddress.SOCKS is not currently supported.
ejona86 commentedon Apr 19, 2022
Seems like this is resolved. If not, comment, and it can be reopened.
If you require SOCKS (not just nice to have) then that is probably best to open a feature request issue for.