You can use a debugging proxy (such as ProxyMan or Charles Proxy) to see outgoing calls coming from your Elixir project. Unfortunately, Elixir doesn't look at your system's proxy settings, so you have to set the proxying manually in your networking library. Here I am using Tesla with Hackney.
use Tesla
adapter(Tesla.Adapter.Hackney, proxy: {"localhost", 9090}, ssl_options: [{:verify, :verify_none}])
# plug Tesla.Middleware.Compression
- The default port for ProxyMan is
9090
, the default for Charles Proxy is8888
. localhost
can also be the127.0.0.1
. This will code only proxy the calls in the module it is added to. I found in the past that adding this to multiple module somehow confused the networking library (I think base urls got swapped). To get around this problem, I give each module a different alias forlocalhost
, like I addedlocalhost-1
to my local routing which still points to127.0.0.1
.- never commit
verify_none
. It turns off ssl certificate validation. Without this you would need to specify ProxyMan's ssl cert info in order to decrypt https requests (which was a bit confusing for me). - disabling
Tesla.Middleware.Compression
was necessary. I think it's because ProxyMan already unzipped the response, but left the header specifying compression, which confused Tesla. Alternatively, use the debugging proxy to remove this header.