Is there an easy way to route Feign traffic through an HTTP proxy server? From looking at feign.Client.Default.convertAndSend I can see URL.openConnection() being called with no option to pass a Proxy. Would this be considered a useful feature?
probably easiest would be to use system properties or okhttp. would either work for you?
I tried the system properties and they do not seem to have an effect. I added the following to the VM args: -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8880
The okhttp solution you suggest implies a custom implementation of feign.Client? I see how this could be passed to the Builder but seems like I would have to drag over a lot of functionality from the default Client.
I added support for the system properties directly to feign.Client.Default and it works well when I provide the VM args above.
https://github.com/rhudson/feign/commit/5d611d7bcb767a26c06bffdc396f256d02dca353
I appreciate any suggestions you have to get similar behavior from Feign without having to fork. Thanks.
He was suggesting to use the already implemented okhttp client https://github.com/Netflix/feign/tree/master/okhttp
Hi, robert.
okhttp is a first-class client, so you don't need to do any work except
configure it to use the proxy you want (if you don't want the system
default)
oops.. spencer already answered :)
ah, ok. Somehow I missed the okhttp section of the docs. I think that will handle my needs just fine. Thanks for the help.
Can we reopen this request?
I have many services which I could not easily change with new classes...
Simple start the services with the proxy-Settings would be be the simplest (and most expected...) way for this to work out of the box.
Setting the global proxy configuration routes every request over the proxy, which is a very hefty solution on normal development systems these days...
Most helpful comment
Can we reopen this request?
I have many services which I could not easily change with new classes...
Simple start the services with the proxy-Settings would be be the simplest (and most expected...) way for this to work out of the box.
Setting the global proxy configuration routes every request over the proxy, which is a very hefty solution on normal development systems these days...