At work we’ve been using Faraday as our main HTTP library. We have four application that communicate with each other ussing HTTP. The architecture is a little bit complex and some of the hosts have acccess to the outside world and some don’t. Because of that, sometimes we have to ignore the proxy and go directly from one host to another, using its VIP…
For instance, Faraday does not support a way of avoiding proxy or setting up a proxy exception. Check it out here and here.
Luckly we’re able to workaround this problem with a simple solution that works like a charm for us.
We use chef to deal with our infrastructure and also with our environment variables, so all you have to do is export your ENV[‘no_proxy’] variable, something like this:
Ok, we’re ready to go with the monkey patch. In order to send HTTP requests from one application to another, we have a simple gem with objects mapped with her, so before initializing your gem, all you have to do is:
And then, setup your gem with Faraday classes:
Pretty simple, huh?