Connection string
http://user1:pass1@proxy.example.com:8080curl
curl -x "http://user1:pass1@proxy.example.com:8080" "https://httpbin.org/ip"
Python (requests)
import requests
proxies = {
"http": "http://user1:pass1@proxy.example.com:8080",
"https": "http://user1:pass1@proxy.example.com:8080",
}
r = requests.get("https://httpbin.org/ip", proxies=proxies, timeout=30)
print(r.status_code, r.text[:200])Node.js
// undici ships with Node 18+ (npm install undici for older versions)
import { ProxyAgent } from "undici";
const dispatcher = new ProxyAgent("http://user1:pass1@proxy.example.com:8080");
const res = await fetch("https://httpbin.org/ip", { dispatcher });
console.log(res.status, await res.text());Environment variables
export HTTP_PROXY="http://user1:pass1@proxy.example.com:8080" export HTTPS_PROXY="http://user1:pass1@proxy.example.com:8080" export ALL_PROXY="http://user1:pass1@proxy.example.com:8080"
Most CLI tools (curl, pip, apt, git) read these automatically.
Python (Scrapy)
# settings.py — via HttpProxyMiddleware (enabled by default)
# or set per-request:
yield scrapy.Request(
"https://httpbin.org/ip",
meta={"proxy": "http://user1:pass1@proxy.example.com:8080"},
)The anatomy of a proxy URL
Almost every tool accepts a proxy as a single URL: scheme://username:password@host:port. The scheme states how your client talks to the proxy (HTTP CONNECT or SOCKS5), not what kind of traffic goes through it — an http:// proxy URL carries HTTPS traffic perfectly well. The most common failure is credentials containing @, : or /: those must be percent-encoded or the URL parses wrong, which is exactly what this builder does for you.
SOCKS5 vs SOCKS5h: where DNS happens
With plain socks5://, your machine resolves hostnames and sends the proxy an IP — meaning your local DNS server sees every domain you visit. With socks5h://, the hostname is passed through and resolved by the proxy, keeping DNS on the proxy's side and matching what the target site expects of that network. For scraping and privacy work, socks5h is usually the right choice; curl and Python's requests both understand the scheme directly.
Verifying the connection actually goes through the proxy
A proxy that silently fails open is worse than one that errors. After wiring up a snippet, point it at an IP-echo endpoint and confirm the address that comes back is the proxy's exit, not your own — the example target above does exactly that, and our What Is My IP tool gives you the same check in a browser. If you need to reason about the proxy's address itself, the CIDR calculator tells you which network it belongs to.