Integration · HTTP clients
How to use a proxy with wget
GNU Wget reads its proxy from http_proxy and https_proxy, from -e https_proxy=... on the command line, or from a .wgetrc, and takes the credentials with --proxy-user and --proxy-password. It authenticates with Basic only and speaks HTTP proxies, not SOCKS. Where it differs from curl is recursion: one command can fetch a whole set of pages, which is where the choice between a rotating and a sticky username matters.
Reviewed 30 Oct 2026
http://USERNAME _pool-arcfast _country-de:PASSWORD@ proxy.arcproxies.io:8000The short answer
https_proxycovers HTTPS URLs andhttp_proxyplain HTTP; set both to the gateway'shttp://address.--proxy-userand--proxy-password, orproxy_user/proxy_passwordin a.wgetrcwith mode 600.- A refused HTTPS tunnel exits with code 4 (network failure); a 407 on plain HTTP exits with 8.
- Wget does not support SOCKS proxies. Use the gateway's HTTP protocol.
Setup
Set up wget with a proxy, step by step
- 01
Fetch one URL and read the exit IP
-eruns a.wgetrccommand, so the proxy applies to this run only and no environment variable is left behind.shell4 lineswget -q -O - \ -e use_proxy=on -e https_proxy=http://proxy.arcproxies.io:8000 \ --proxy-user="USERNAME_pool-arcfast_country-de" --proxy-password="PASSWORD" \ "https://api.ipify.org?format=json" - 02
Keep credentials in a .wgetrc
Command-line passwords can show up in process listings and shell history. A startup file read through
WGETRCkeeps them out, andchmod 600keeps other users out of the file.shell10 linescat > ~/.wgetrc-arc <<'EOF'use_proxy = onhttp_proxy = http://proxy.arcproxies.io:8000https_proxy = http://proxy.arcproxies.io:8000proxy_user = USERNAME_pool-arcfast_country-deproxy_password = PASSWORDEOFchmod 600 ~/.wgetrc-arcWGETRC=~/.wgetrc-arc wget -q -O - https://api.ipify.org - 03
Mirror a section from one exit
Within one run Wget reuses its connection to a host where it can, but a long recursive fetch reconnects. A sticky username keeps the whole job on one address;
--waitand--random-waitpace it.shell6 linesWGETRC=~/.wgetrc-arc wget \ --proxy-user="USERNAME_pool-arcfast_country-de_session-k3f9a1x2_sesstime-10" \ --recursive --level=1 --no-parent \ --wait=2 --random-wait \ --accept html \ https://example.com/catalogue/ - 04
Compare countries and cities
Override the username per run. Cities come from the published list, lowercased without spaces.
shell7 linesfor user in \ "USERNAME_pool-arcfast_country-de_city-hamburg" \ "USERNAME_pool-arcfast_country-fr_city-marseille" \ "USERNAME_pool-arcfast_country-au_city-brisbane"do WGETRC=~/.wgetrc-arc wget -q -O - --proxy-user="$user" https://api.ipify.org; echo " $user"done - 05
Timeouts, retries and exit codes in scripts
--tries(20 by default) retries transient failures;--retry-on-http-erroradds status codes such as 429 and 503. A refused tunnel is not retried. Check the exit code: 4 is a network failure, which covers a proxy that refused the tunnel and, in our test, a listed status that persisted through every try; 8 means the server answered with an error.shell12 linesWGETRC=~/.wgetrc-arc wget -q \ --timeout=30 --tries=4 --waitretry=8 \ --retry-on-http-error=429,503 \ -O page.html "https://example.com/products?page=1"status=$?case $status in 0) echo "ok" ;; 4) echo "network failure or retries used up: check proxy credentials (407) and the site" ;; 8) echo "server returned an error status" ;; *) echo "wget exit $status" ;;esac
Where wget reads proxy settings
| Source | Example | Note |
|---|---|---|
| Environment | https_proxy=http://host:port wget … | Lowercase names; no_proxy lists domains to reach directly |
-e command | -e https_proxy=http://host:port | This run only; overrides the environment |
| Startup file | https_proxy = … in .wgetrc or the file in WGETRC | Also holds proxy_user and proxy_password |
| Credentials in the URL | https_proxy=http://user:pass@host:port | Works, but the password ends up in the environment |
| Off switch | --no-proxy or use_proxy = off | Ignores all of the above |
HTTPS through the gateway
For an https:// URL, Wget sends CONNECT host:443 to the gateway with the Basic credentials, then runs TLS inside the tunnel, so the gateway never sees the page. If the gateway answers 407, Wget prints "Proxy tunneling failed: Proxy Authentication Required" and exits with 4. The HTTP CONNECT glossary entry explains the mechanism, and proxy authentication the 407 challenge.
Wget fetches whatever it is told to, so a recursive job through a per-GB proxy can use more data than expected. Limit it with --accept, --level and --reject; reducing proxy bandwidth has more ways.
The problem
Common pitfalls
Setting only http_proxy
http_proxy applies to plain-HTTP URLs. HTTPS URLs use https_proxy; without it they go direct.
Expecting --tries to fix a 407
A refused tunnel was not retried in our test. Fix the credentials instead.
A socks5:// proxy URL
Wget's proxy support covers HTTP proxies. Point it at the gateway with http://.
Recursive jobs without limits
Without --level, --no-parent and an accept list, a recursive fetch follows every link it is allowed to. Respect the site's robots rules, which Wget honours by default, and its pace.
FAQ
Questions
Something not covered? Write to contact@arcproxies.io.
How do I use wget with a proxy that needs a username and password?
Set the proxy and pass the credentials: wget -e https_proxy=http://host:port --proxy-user=USER --proxy-password=PASS https://example.com. Wget sends them with Basic authentication.
Which environment variable does wget use for HTTPS?
https_proxy. http_proxy is only used for plain-HTTP URLs. Both should contain the proxy's URL, for example http://host:port.
Does wget support SOCKS5 proxies?
No. GNU Wget supports HTTP proxies (and FTP through them). For SOCKS5 use curl, or use the gateway's HTTP protocol with Wget.
What does "Proxy tunneling failed: Proxy Authentication Required" mean in wget?
The proxy refused the CONNECT request for an HTTPS URL because the credentials were missing or wrong. Wget exits with status 4. Check --proxy-user and --proxy-password, or proxy_user and proxy_password in your .wgetrc.
Sources & review
Last reviewed by the ARC Proxies team. Prices are read from the live catalog at build time.
Next
What people build with it
Integrations
Other http clients
Get started
Get credentials and paste them in.
Sign up, buy a gigabyte, generate a username in the dashboard. Code WELCOME15 takes 15% off your first purchase; bandwidth never expires.