Guide to Configuring a Wget Proxy
Wget is a free command-line tool for downloading files over HTTP, HTTPS and FTP. It’s part of the GNU project, available on Linux, macOS and Windows, and widely used in scripts, servers and CI pipelines. This guide shows how to make Wget use a proxy: with environment variables, command-line options or the .wgetrc file, with authentication, plus troubleshooting and the limits you should know about.
Need a proxy to test these commands? Get a trial on QuickProxy for only $1.99.
How Wget uses a proxy
Wget reads proxy settings from three places, in this order of priority: command-line options (-e), the configuration file, and environment variables. It supports HTTP and HTTPS proxies. For an HTTPS website, Wget asks the proxy to open a tunnel (CONNECT), so the content stays encrypted end to end.
Classic Wget doesn’t support SOCKS proxies. If you need SOCKS5, use cURL, or a wrapper such as proxychains.
The examples below use the Quick Proxy gateway gate.quickproxy.io:8000. Replace username and password with your own; add a country code to choose a location, for example username-cc-us.
Method 1: environment variables
Wget reads the standard proxy variables, which many other command-line tools use too:
export http_proxy="http://gate.quickproxy.io:8000"
export https_proxy="http://gate.quickproxy.io:8000"
export no_proxy="localhost,127.0.0.1,.internal.example"
wget --proxy-user="username-cc-us" --proxy-password="password" https://example.com/file.zip
Note that https_proxy also starts with http://: it describes how Wget talks to the proxy, not to the website. Add the export lines to ~/.bashrc to make them permanent, or set them only for one command by putting them in front of it.
On Windows (Command Prompt), use set https_proxy=http://gate.quickproxy.io:8000 instead of export.
Method 2: command-line options
Use -e to pass settings for a single run, without changing your environment:
wget -e use_proxy=yes \
-e https_proxy=http://gate.quickproxy.io:8000 \
--proxy-user="username-cc-gb" --proxy-password="password" \
https://example.com/file.zip
To ignore all proxy settings for one download, use --no-proxy.
Method 3: the .wgetrc file
For settings that should apply every time, add them to ~/.wgetrc (for your user) or /etc/wgetrc (for all users):
use_proxy = on
http_proxy = http://gate.quickproxy.io:8000
https_proxy = http://gate.quickproxy.io:8000
proxy_user = username-cc-de
proxy_password = password
no_proxy = localhost,127.0.0.1
Protect the file, since it holds your password: chmod 600 ~/.wgetrc.
Keeping credentials safe
- Avoid putting the password directly in commands you share or commit: it ends up in shell history, logs and repositories.
- In scripts, read it from an environment variable or a secrets manager, for example
--proxy-password="$PROXY_PASS". - If the password contains special characters such as
@,:or#, the--proxy-userand--proxy-passwordoptions are safer than putting credentials inside a URL.
Useful options for downloads through a proxy
| Option | What it does |
|---|---|
-c |
Resumes a partly downloaded file instead of starting again |
--tries=5 and --waitretry=10 |
Retries failed downloads, waiting longer between attempts |
--timeout=30 |
Gives up on a stalled connection after 30 seconds |
--wait=2 and --random-wait |
Pauses between requests when downloading many files, so you don’t overload the site |
--limit-rate=1m |
Caps the download speed, which also limits bandwidth use |
-S |
Shows the server’s response headers, useful for debugging |
Residential proxy plans are usually billed by traffic, so download only what you need, resume interrupted files with -c, and avoid mirroring whole websites through the proxy.
Checking that the proxy works
Download a page that shows your IP address and look at the result:
wget -qO- --proxy-user="username-cc-us" --proxy-password="$PROXY_PASS" https://api.ipify.org
The IP shown should be in the country you chose, not your own.
Troubleshooting
- “407 Proxy Authentication Required”: the username or password is wrong or missing. Check the country code in the username. See the authentication guide.
- “Connection refused” or a timeout when connecting to the proxy: check the host and port, and whether a firewall blocks outgoing connections to port 8000.
- The proxy is ignored: check for
use_proxy = offin a.wgetrcfile, a--no-proxyoption, or a host listed inno_proxy. - Certificate errors: update your system’s CA certificates. Don’t use
--no-check-certificateas a permanent fix, because it turns off protection against tampered connections.
For other codes, see the most common proxy errors.
Conclusion
Wget uses HTTP and HTTPS proxies through environment variables, -e options or a .wgetrc file. Use --proxy-user and --proxy-password for credentials, keep passwords out of history and repositories, and add retries and timeouts for reliable downloads. For SOCKS5, use cURL instead. For system-wide settings, see proxy settings for browsers and operating systems.
Try these commands with real residential IPs: start a $1.99 trial.
Questions and Answers
Q1: How do I make Wget use a proxy?
A1: Set the http_proxy and https_proxy environment variables, pass them with -e, or add them to ~/.wgetrc.
Q2: How do I pass a proxy username and password to Wget?
A2: Use --proxy-user and --proxy-password, or proxy_user and proxy_password in .wgetrc.
Q3: Does Wget support SOCKS5 proxies?
A3: No. Classic Wget supports HTTP and HTTPS proxies only. Use cURL or a wrapper such as proxychains for SOCKS5.
Q4: How do I bypass the proxy for one download?
A4: Add --no-proxy to the command, or list the host in the no_proxy variable.
Related reading
Put the article into practice.
Spin up real residential IPs in 150+ countries. Pay once or subscribe — from $11.