Setting a proxy for wget takes about 30 seconds once you know which of the four supported methods to use. wget reads its proxy configuration from environment variables, from ~/.wgetrc, from /etc/wgetrc, and from inline command-line flags — and the precedence is exactly the reverse: command-line flags win, then user .wgetrc, then system /etc/wgetrc, then environment variables. This guide walks through all four methods on Linux and macOS, covers HTTP/HTTPS/SOCKS5, shows authentication with username and password, explains the proxy-bypass list for internal hosts, and ships a working SpyderProxy configuration you can copy verbatim.
Every command in this guide was tested on Ubuntu 24.04 LTS and macOS 14 Sonoma with GNU Wget 1.25.0. SOCKS5 examples use proxychains4 4.16. The proxy used for testing is SpyderProxy Premium Residential at $2.75/GB.
If you just want it working right now, this is the fastest path. Replace USERNAME, PASSWORD, and the gateway with your SpyderProxy credentials:
export http_proxy="http://USERNAME:[email protected]:7777"
export https_proxy="$http_proxy"
export no_proxy="localhost,127.0.0.1,::1"
wget https://httpbin.org/ip
That is it. Every wget command in the same shell session will route through SpyderProxy. To make the change permanent, append those three export lines to your ~/.bashrc (or ~/.zshrc on macOS) and source the file. The rest of this guide explains why each option exists, when to use which method, and how to debug it when something fails.
When wget starts up it walks four sources in order. Later sources override earlier ones:
http_proxy, https_proxy, ftp_proxy, no_proxy. wget also checks the uppercase versions (HTTP_PROXY, etc.) but the lowercase forms are recommended./etc/wgetrc. Set by your distro / sysadmin.~/.wgetrc. Set by you.-e use_proxy=yes, -e https_proxy=..., --proxy-user=..., --proxy-password=.... Highest precedence.Pick one mechanism per use case. Mixing them is where most "why is wget bypassing my proxy?" questions come from.
Environment variables are the simplest, the most portable across tools (curl, npm, pip, apt, and many others honour the same variable names), and the easiest to script. They are also the right answer for short-lived shells, CI pipelines, and Docker containers.
export http_proxy="http://USERNAME:[email protected]:7777"
export https_proxy="$http_proxy"
export no_proxy="localhost,127.0.0.1,::1,*.internal.example.com"
wget https://example.com
Append the three exports to your shell's startup file. On Ubuntu and most Linux distributions this is ~/.bashrc; on macOS Sonoma it is ~/.zshrc:
# Linux
echo 'export http_proxy="http://USERNAME:[email protected]:7777"' >> ~/.bashrc
echo 'export https_proxy="$http_proxy"' >> ~/.bashrc
echo 'export no_proxy="localhost,127.0.0.1,::1"' >> ~/.bashrc
source ~/.bashrc
# macOS
echo 'export http_proxy="http://USERNAME:[email protected]:7777"' >> ~/.zshrc
echo 'export https_proxy="$http_proxy"' >> ~/.zshrc
echo 'export no_proxy="localhost,127.0.0.1,::1"' >> ~/.zshrc
source ~/.zshrc
http_proxy="http://USERNAME:[email protected]:7777" \
https_proxy="http://USERNAME:[email protected]:7777" \
wget https://example.com
This invocation sets the proxy only for that single wget call without touching your shell environment. Useful in Makefiles and one-off scripts.
If you want wget to use a proxy but you do not want curl, npm, pip, and apt to also pick it up, set the proxy in ~/.wgetrc instead of environment variables. This file is wget-specific.
Create or edit ~/.wgetrc with these lines:
# ~/.wgetrc
use_proxy = on
http_proxy = http://gw.spyderproxy.com:7777
https_proxy = http://gw.spyderproxy.com:7777
proxy_user = USERNAME
proxy_password = PASSWORD
no_proxy = localhost,127.0.0.1,::1
Set the file permissions to 600 so that other users on the machine cannot read your password:
chmod 600 ~/.wgetrc
Now every wget invocation will route through SpyderProxy automatically:
wget https://httpbin.org/ip
For one-off downloads that need a different proxy than your defaults, pass flags inline. The relevant ones are -e (set a runtime config option, same syntax as .wgetrc), --proxy-user, and --proxy-password.
wget \
-e use_proxy=yes \
-e http_proxy=gw.spyderproxy.com:7777 \
-e https_proxy=gw.spyderproxy.com:7777 \
--proxy-user=USERNAME \
--proxy-password=PASSWORD \
https://httpbin.org/ip
Command-line flags override every other source, so this works even when your environment variables or ~/.wgetrc point at a different proxy. To explicitly bypass any configured proxy for one call, use --no-proxy:
wget --no-proxy https://internal.example.com
If you administer a multi-user Linux machine and want every user to route wget through the same proxy by default, edit /etc/wgetrc as root. The syntax is identical to ~/.wgetrc:
sudo nano /etc/wgetrc
# add or uncomment these lines:
use_proxy = on
http_proxy = http://gw.spyderproxy.com:7777
https_proxy = http://gw.spyderproxy.com:7777
proxy_user = USERNAME
proxy_password = PASSWORD
no_proxy = localhost,127.0.0.1,::1,.internal.example.com
Individual users can still override system settings with their own ~/.wgetrc or environment variables.
SpyderProxy and most paid residential providers require authentication. There are three places to put credentials, in increasing safety:
export http_proxy="http://USERNAME:[email protected]:7777"
wget --proxy-user=USERNAME --proxy-password=PASSWORD \
-e use_proxy=yes -e http_proxy=gw.spyderproxy.com:7777 \
https://example.com
# ~/.wgetrc
proxy_user = USERNAME
proxy_password = PASSWORD
chmod 600 ~/.wgetrc
For automated scripts, prefer environment variables sourced from a .env file (also chmod 600) rather than hardcoding credentials in the script itself.
If your password contains @, :, /, ?, #, or &, you must URL-encode them or wget will misparse the URL. Quick lookup:
| Character | Encoded |
|---|---|
| @ | %40 |
| : | %3A |
| / | %2F |
| ? | %3F |
| # | %23 |
| & | %26 |
| + | %2B |
| space | %20 |
If your password is p@ssw0rd!, the URL-encoded form is p%40ssw0rd%21:
export http_proxy="http://user:p%40ssw0rd%[email protected]:7777"
wget does not support SOCKS5 natively. To route wget through SOCKS5 you wrap the call with proxychains4 (Linux + macOS) or tsocks (Linux). proxychains4 is the more actively maintained option.
# Ubuntu / Debian
sudo apt install proxychains4
# macOS
brew install proxychains-ng
strict_chain
proxy_dns
remote_dns_subnet 224
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 gw.spyderproxy.com 1080 USERNAME PASSWORD
proxychains4 wget https://httpbin.org/ip
You will see proxychains4 print connection info on stderr ([proxychains] Strict chain ... 127.0.0.1:1080 ... gw.spyderproxy.com:1080 ... OK) followed by wget's normal output. The destination sees the SpyderProxy egress IP.
SpyderProxy's rotating residential gateway issues a new IP per TCP connection. Each fresh wget invocation gets a different residential IP automatically:
# Each call gets a different residential IP
for i in {1..10}; do
wget -qO- https://httpbin.org/ip
done
For sticky sessions (10-minute or 24-hour persistence), append a session ID to your username. Use the same suffix to keep the same IP; change it to rotate:
export http_proxy="http://USERNAME-session-abc123:[email protected]:7777"
export https_proxy="$http_proxy"
wget https://example.com # IP A
wget https://example.com # IP A (same session)
# rotate by changing the session id
export http_proxy="http://USERNAME-session-def456:[email protected]:7777"
wget https://example.com # IP B
The no_proxy environment variable (also no_proxy in .wgetrc) tells wget which hosts and domains should bypass the proxy. Standard practice is to always exclude loopback and any internal corporate domains:
export no_proxy="localhost,127.0.0.1,::1,.internal.example.com,.intranet"
The leading dot on a domain matches that domain and all subdomains. .internal.example.com matches both foo.internal.example.com and internal.example.com itself.
The fastest sanity check is fetching https://httpbin.org/ip twice — once with the proxy, once without — and confirming the IPs differ:
# Without proxy (your real IP)
wget --no-proxy -qO- https://httpbin.org/ip
# With proxy (SpyderProxy egress IP)
wget -qO- https://httpbin.org/ip
The first command prints your home/office IP. The second prints a residential IP from somewhere in the SpyderProxy pool — different country, different ASN, different reverse DNS. You can also use our free IP Lookup and Proxy Checker tools for richer output (geolocation, ASN, blacklist status).
Your credentials are wrong, missing, or improperly URL-encoded. Re-check:
~/.wgetrc, the file has chmod 600 and is in your home directory.The gateway hostname or port is wrong, or your firewall blocks egress. Confirm with:
curl -v -x http://USER:[email protected]:7777 https://httpbin.org/ip
If curl fails too, the issue is network or credentials, not wget.
Check precedence. Command-line flags override ~/.wgetrc which overrides /etc/wgetrc which overrides environment variables. Some scripts call wget --no-proxy explicitly. Run wget -d for debug output that prints which proxy wget is actually using.
Update your CA bundle: sudo apt install --reinstall ca-certificates on Linux, or brew install ca-certificates on macOS. Never use --no-check-certificate in production — it disables TLS verification. SpyderProxy gateways use publicly-trusted certificates so this should never be necessary on our service.
You set only one of http_proxy / https_proxy. Set both. Most providers including SpyderProxy use the same gateway URL for both schemes.
wget --limit-rate=200k.wget --wait=2 --random-wait -i urls.txt.--tries=10 --timeout=30 --retry-connrefused.cat urls.txt | xargs -P 8 -n 1 wget.--user-agent="Mozilla/5.0 (compatible; SpyderBot/1.0)".For most users, three lines in ~/.bashrc or ~/.zshrc are all you need to put wget behind a proxy. Use environment variables for cross-tool config, ~/.wgetrc for wget-only config, command-line flags for one-off overrides, and /etc/wgetrc for system-wide policy. For SOCKS5, wrap wget with proxychains4. SpyderProxy supports all of these patterns out of the box — Premium Residential at $2.75/GB ships rotating sessions, sticky sessions up to 24 hours, 130M+ IPs across 195+ countries, and SOCKS5 + HTTP/HTTPS gateways. For the protocol-level differences between wget and curl, see our curl vs wget deep-dive.