Proxy in reqwest: HTTP and SOCKS5
In reqwest the proxy is attached in the client builder. Here is HTTP with basic_auth and a one-line switch to SOCKS5.

Why use a proxy in Rust reqwest
reqwest is a popular Rust HTTP client with async and blocking APIs. The proxy is created with reqwest::Proxy::all and passed to Client::builder().proxy(). SOCKS needs the socks feature.
HTTP fits most tasks. If you need SOCKS5, enable the socks feature and use the socks5h scheme so DNS goes through the proxy. Rotation for data collection, a sticky session for sequential requests.
Residential
from $0.6 / GBHome ISP addresses. The main choice for accounts and protected sites.
VIP
$2 / GBHand-picked clean IPs, faster and more stable than regular residential.
Mobile
$4 / GBCarrier IPs, for platforms that check addresses strictly.
Step-by-step setup
Button names are given exactly as they appear in Rust reqwest.
Add the crate
Run cargo add reqwest --features blocking,socks. blocking is for the example without async, socks for SOCKS5.
Export the proxy
Take host, port, login and password in @SousProxyBot or the dashboard.
Create a Proxy
reqwest::Proxy::all("http://HOST:PORT")?.basic_auth("LOGIN", "PASSWORD"). Proxy::all routes both http and https through the proxy.
Build the client
Pass the proxy to Client::builder().proxy(proxy).build().
Run and check the IP
Run cargo run. The console shows JSON with the proxy IP.
Code example
Put in your own HOST, PORT, LOGIN and PASSWORD from the bot or the dashboard.
fn main() -> Result<(), Box<dyn std::error::Error>> {
// SOCKS5: "socks5h://HOST:PORT" (needs the socks feature)
let proxy = reqwest::Proxy::all("http://HOST:PORT")?
.basic_auth("LOGIN", "PASSWORD");
let client = reqwest::blocking::Client::builder()
.proxy(proxy)
.build()?;
let body = client
.get("https://api.ipify.org?format=json")
.send()?
.text()?;
println!("{body}");
Ok(())
}
Tested by running it
We ran this example ourselves: Rust 1.97.0 · reqwest 0.13.5 (features: blocking). Real output below, IP hidden.
$ cargo run Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s Running `target/debug/ipcheck` {"ip":"proxy IP"}
And this is the response when the password is wrong:
$ cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
Running `target/debug/ipcheck`
Error: reqwest::Error { kind: Request, url: "https://api.ipify.org/?format=json", source: hyper_util::client::legacy::Error(Connect, ProxyAuthRequired) }Check that it works
Open these pages through Rust reqwest with the proxy on.
Common errors
The issues people most often bring to support.
Build error: reqwest::blocking not foundThe blocking feature isn't enabled. Add it in Cargo.toml or rewrite the example as async with tokio.
Error with socks5h:// in Proxy::allThe socks feature isn't enabled. Run cargo add reqwest --features socks.
407 response from the proxyCheck the login and password in basic_auth. For SOCKS5 you can put them right in the URL.
error sending request with rotationOne IP turned out slow. Set a timeout in the builder and retry the request.
FAQ
How do I do this in async code?
Use reqwest::Client instead of blocking::Client and add .await to send() and text(). The proxy is attached the same way.
Does reqwest read HTTP_PROXY?
Yes, system proxies are used by default unless you set your own. An explicit .proxy() is more reliable and clearer.
What's the difference between socks5 and socks5h?
With socks5 the domain resolves on your side, with socks5h on the proxy side. Check for a leak on /en/tools/dns-leak-test/.
