emilk / ehttp

Minimal Rust HTTP client for both native and WASM
Apache License 2.0
323 stars 30 forks source link

Hello, is there a way to proxify the requests ? #19

Open deft01 opened 1 year ago

emilk commented 1 year ago

Theoretically, yes.

ehttp is a thin wrapper around ureq and web_sys::Request, and they both support proxied requests.

Try it?

zicklag commented 1 year ago

On the web, the requests are proxied automatically with the same configuration as the browser. On native, ureq requires the user agent to be configure with the try_proxy_from_env(true) flag.

Additionally, to support proxies with custom SSL bump certificates, you have to enable the native TLS adapter in ureq.

I have need for both of these features, would you be open to adding some way to configure it?

Possibly an easy way to do so without requiring increased API surface would be to have feature flags for using the native TLS store and reading proxy environment variables. You might even be open to using proxy environment variables by default, like reqwest does. ureq doesn't by default because it's a security risk, but that risk obviously depends on the context you're in.