No KYC — no ID, no selfie, no documents. Pay in crypto: BTC, USDT, USDC, ETH, SOL, LTC
Language: English
Get started

Docs · curl 7.x and 8.x · Linux, macOS, Windows · checked 13 November 2026

How do I use a proxy with curl?

curl is the fastest way to test credentials, targeting and timing before touching a scraper. Every command below runs as it is once USERNAME and PASSWORD are replaced.

Last updated: · 5 min read

Quick answer

How do I use a proxy with curl?

CrawlRelay works with curl through -x http://gw.crawlrelay.com:7777 and -U USERNAME:PASSWORD, or --socks5-hostname on port 7778 for SOCKS5. Add the country and a session to the username, such as USERNAME-country-de-session-t1-ttl-10, to keep one IP for 10 minutes. A 1 GB test plan costs $1.50.

In brief
  • HTTP proxy: -x http://gw.crawlrelay.com:7777 with -U for the credentials.
  • SOCKS5: --socks5-hostname gw.crawlrelay.com:7778, so DNS resolves at the exit.
  • Debugging: -v shows the CONNECT answer; -w prints the CONNECT status, HTTP status, bytes and timings.
  • Windows: call curl.exe, since curl is an alias of Invoke-WebRequest in PowerShell 5.1.
  • Cost: $1.50 for 1 GB, enough for thousands of test commands.

Which curl flags do I need for a proxy?

Which curl flags do I need for a proxy?
-x / --proxyProxy URL: http://host:port, credentials optional inside it
-U / --proxy-userProxy credentials as USERNAME:PASSWORD, kept out of the URL
--socks5-hostnameSOCKS5 proxy with DNS resolved at the exit
-vShows the CONNECT exchange and the proxy's status line
-wPrints timing, size and %{http_connect}, the proxy's CONNECT status
--max-time, --connect-timeoutTotal and connection time limits, in seconds

What are the basic proxy commands?

Four commands cover the cases: rotating, targeted by city, sticky, and SOCKS5. Each prints the exit IP that the website sees. City availability varies by country, and a sticky IP can change before its ttl ends if the residential device goes offline.

HTTP proxy, rotating, then targeted and sticky
# Rotating exit, any country
curl -x http://gw.crawlrelay.com:7777 -U USERNAME:PASSWORD https://api.ipify.org

# Country and city (city availability varies)
curl -x http://gw.crawlrelay.com:7777 -U USERNAME-country-us-city-chicago:PASSWORD https://api.ipify.org

# Sticky: run it twice, the IP stays the same for up to 10 minutes (it can change earlier)
curl -x http://gw.crawlrelay.com:7777 -U USERNAME-country-de-session-t1-ttl-10:PASSWORD https://api.ipify.org

# SOCKS5, DNS resolved at the exit
curl --socks5-hostname gw.crawlrelay.com:7778 -U USERNAME-country-gb:PASSWORD https://api.ipify.org

How do I debug a proxy connection with curl?

Run curl with -v and read the status line that follows CONNECT: 200 means the tunnel works, anything else came from the proxy. A working tunnel shows HTTP/1.1 200 Connection established, then the TLS handshake with the website. A 407 means credentials; a 502 or 504 means the exit or the target. The -w format below prints the same information in one line, which is handy in loops and CI checks. The error reference explains each status curl can report.

Verbose CONNECT and a one-line timing report
# Full exchange, including the proxy's answer to CONNECT
curl -v -x http://gw.crawlrelay.com:7777 -U USERNAME:PASSWORD https://example.com/ -o /dev/null

# One line: proxy CONNECT status, HTTP status, compressed bytes and timings
curl -s --compressed -o /dev/null -x http://gw.crawlrelay.com:7777 -U USERNAME-country-us:PASSWORD \
  -w 'connect=%{http_connect} http=%{http_code} bytes=%{size_download} tcp=%{time_connect}s tls=%{time_appconnect}s ttfb=%{time_starttransfer}s total=%{time_total}s\n' \
  https://example.com/

How do I check that rotation and sessions work?

Request the IP five times in a loop: without a session the answers usually differ, with one they stay the same. Each curl run opens a new connection, so the rotating loop usually shows a different IP every time. With a session ID, the IP should stay the same until the ttl ends, though it can change earlier. The sessions guide explains how other clients reuse connections.

Rotation vs sticky in a shell loop
echo "rotating:"
for i in 1 2 3 4 5; do
  curl -s -x http://gw.crawlrelay.com:7777 -U USERNAME-country-us:PASSWORD https://api.ipify.org; echo
done

echo "sticky:"
for i in 1 2 3 4 5; do
  curl -s -x http://gw.crawlrelay.com:7777 -U USERNAME-country-us-session-loop1-ttl-5:PASSWORD https://api.ipify.org; echo
done

How do I use curl with a proxy on Windows?

Call curl.exe, not curl, because PowerShell 5.1 maps curl to Invoke-WebRequest. Invoke-WebRequest does not understand -x or -U. Windows 10 and 11 ship the real curl as curl.exe. In PowerShell, quote arguments that contain special characters, and write a literal $ in a password inside single quotes.

PowerShell
curl.exe -x http://gw.crawlrelay.com:7777 -U 'USERNAME-country-fr:PASSWORD' https://api.ipify.org

How do I set the proxy once for every command?

Export https_proxy and http_proxy for the shell session, and list the hosts to skip in NO_PROXY. curl reads both variables, and many other command-line tools read them too. Avoid exporting the password to every child process on a shared machine.

Environment variables (bash, zsh)
export https_proxy="http://USERNAME-country-us:[email protected]:7777"
export http_proxy="$https_proxy"
export NO_PROXY="localhost,127.0.0.1,.internal.example"

curl https://api.ipify.org   # now uses the proxy
unset https_proxy http_proxy # back to direct

How do I measure what a page costs through the proxy?

Run curl with --compressed and -w '%{size_download}' on a handful of real pages: the figure is the compressed size that crosses the wire. With --compressed, curl asks for gzip or brotli as a scraper does. Without it, many servers send the page uncompressed and the figure can be several times higher. Multiply the average by the number of pages to estimate gigabytes; the bandwidth guide does the arithmetic for common page types.

According to CrawlRelay's survey of 13 October 2026, the median residential price was $4.00/GB at 1 GB across 8 offers. CrawlRelay sells 1 GB for $1.50, and failed connection attempts that never reach the target are not counted.

curl and proxies: questions

What is the difference between --socks5 and --socks5-hostname with CrawlRelay?

With --socks5, curl resolves the hostname locally and sends an IP to CrawlRelay. With --socks5-hostname, the exit resolves it, so DNS answers match the exit country and the local resolver never sees the domains fetched.

Why does curl say CONNECT tunnel failed, response 407 with CrawlRelay?

CrawlRelay rejected the credentials or received none. Check the username and password, URL-encode special characters inside -x, or pass them with -U; the 407 page lists other causes.

Can curl use HTTP/2 or HTTP/3 through CrawlRelay?

HTTP/2 works inside the CrawlRelay CONNECT tunnel when the website supports it, since the tunnel carries TLS end to end. HTTP/3 runs over UDP, which an HTTP CONNECT tunnel does not carry, so use HTTP/2 or HTTP/1.1.

Does a failed curl test cost CrawlRelay traffic?

Barely. CrawlRelay does not count connection attempts that fail before reaching the target, and a 407 moves only a few hundred bytes. A block page from the website is a normal response and counts like any page.

Verdict
  • Test every new username with curl first: one command separates credential, targeting and target problems before a scraper hides them.
  • Use -w in CI checks to log the CONNECT status, HTTP status and bytes per page on every deploy.
Sources (2)
  1. curl man page: -x, -U, --socks5-hostname, -w variables — curl project (read 2026-11-13)
  2. RFC 9110, HTTP Semantics: CONNECT — IETF (read 2026-11-13)

Test your targets from the command line

$1.50 for 1 GB, enough for thousands of curl tests; traffic never expires.

From $0.50/GB · no KYC

Get started