req icon indicating copy to clipboard operation
req copied to clipboard

Support http_proxy and https_proxy environment variables

Open gmile opened this issue 1 year ago • 1 comments

It would be great if Req supported reading http_proxy and https_proxy environment variables out of the box. A use case I have in mind is being able to debug HTTP interaction in programs that use Req as an HTTP client. For example, via tools like mitmproxy.

In my own programs, I can use proxy settings introduced in https://github.com/wojtekmach/req/pull/149 or even go as far as to use System.get_env to optionally read http_proxy and https_proxy ENV vars. However, for packages that rely on Req this may be much harder and requi modification of the package's source code (unless I am missing something, of course).

P.S. I am not sure if this is the right place to file an issue, or if it should be Finch 🙈 Mint issue tracker would not the right place, it seems (based on https://github.com/elixir-mint/mint/issues/92)

gmile avatar Jul 21 '24 12:07 gmile

Yes, PRs appreciated!

I think we should support http_proxy env var out of the box but also have an :http_proxy option that can be set with the same value. (Same goes for https.) WDYT?

This recently came up with https://elixirforum.com/t/making-a-req-request-with-proxy/65771/2.

wojtekmach avatar Aug 30 '24 09:08 wojtekmach