Skip to content

How to Set Up a Proxy for Wget: Environment Variables, .wgetrc and Passwords

How to make wget download through a proxy: the variables to set, how to pass a username and password, the startup file, addresses that skip the proxy, how to switch it off and how to check that it works.

What a proxy changes and what it does not

A proxy changes only the network path between your computer and the server you download from. It does not change the address you ask for or the rules of the site you download from. This guide is about the wget command; for a proxy for the whole system, see the Linux proxy guide, and for the curl command see the curl guide.

Environment variables: the standard way

The GNU Wget manual calls environment variables the standard way to tell Wget where the proxy is. http_proxy and https_proxy hold the URLs of the proxies for HTTP and HTTPS connections, and no_proxy holds a comma-separated list of domain extensions the proxy should not be used for. A variable lives only in the terminal window where you set it. On Windows PowerShell write $env:https_proxy = "..." instead of export.

Set the proxy for the terminal session: example

export http_proxy=http://USERNAME:PASSWORD@HOST:PORT/
export https_proxy=http://USERNAME:PASSWORD@HOST:PORT/
wget https://example.com/file.zip

Replace HOST, PORT, USERNAME and PASSWORD with the values from My assets.

Username and password

The manual shows two ways. One is to put the username and password in the proxy URL, as in http://hniksic:[email protected]:8001/. The other is the options --proxy-user and --proxy-password (in the startup file proxy_user and proxy_password); Wget encodes them with the basic authentication scheme, which the manual says is the only scheme implemented for proxy authorization. In a URL the manual says unsafe characters can be written as %xy and lists % (%25), : (%3A) and @ (%40), so if your password has one of them, write it that way and test with the check below. The proxy pages do not discuss special characters in a password, so that is an inference from the URL rules. A password typed in a command stays in your shell history; the manual notes that the same security considerations as for --http-password apply.

Username and password as options: example

export https_proxy=http://HOST:PORT/
wget --proxy-user=USERNAME --proxy-password=PASSWORD https://example.com/file.zip

Replace HOST, PORT, USERNAME and PASSWORD with the values from My assets.

Save it in the .wgetrc startup file

Wget also reads settings from its startup file, .wgetrc. The manual says Wget first reads a global file (/usr/local/etc/wgetrc by default), then your own: the file named by the WGETRC variable if it is set, otherwise $HOME/.wgetrc; your file overrides the global one. The --config option names another file and --no-config stops config files from being read. The proxy commands there override the proxy settings of the environment: http_proxy, https_proxy, no_proxy, proxy_user and proxy_password, plus use_proxy, which set to off tells Wget not to use a proxy even if proxy variables are set. The manual does not say where $HOME is on Windows; if you are not sure, use the environment variables above: they need no file.

Proxy lines in .wgetrc: example

http_proxy = http://HOST:PORT/
https_proxy = http://HOST:PORT/
proxy_user = USERNAME
proxy_password = PASSWORD
no_proxy = .internal.example

Replace HOST, PORT, USERNAME and PASSWORD with the values from My assets.

Addresses that should not use the proxy

Put internal or local hosts into no_proxy, a comma-separated list of domain extensions. The manual's example is that with no_proxy set to .mit.edu, the proxy is not used to retrieve documents from MIT. To skip the proxy for one run, add --no-proxy (the manual says it suppresses the use of a proxy even if the environment variables are set).

Skip the proxy for one run: example

wget --no-proxy http://internal-server.local/data.csv

The URL is only an example; --no-proxy applies to this one run.

SOCKS5

The manual's proxy page says Wget supports proxies for HTTP and FTP retrievals and does not mention SOCKS. So this guide uses an HTTP proxy address only: choose HTTP when you generate the Proxy302 proxy.

How to switch the proxy off

Close the terminal window, or run unset http_proxy https_proxy no_proxy. Delete the proxy lines from .wgetrc, or set use_proxy = off there. For one run add --no-proxy.

How to check that Wget uses the proxy

  1. Ask a service for your address

    The first command below saves the answer of https://ipinfo.io/json to a file and prints it. The address in it should be the proxy's exit, not your own.

  2. Compare with curl

    The second command asks through the same proxy with curl. If curl works and Wget does not, look for a leftover .wgetrc or no_proxy entry.

  3. Then download something small

    Download a small file you can read, with the proxy set.

How to check that Wget uses the proxy: example

wget -q -O ipinfo.json https://ipinfo.io/json && cat ipinfo.json
curl -x http://USERNAME:PASSWORD@HOST:PORT https://ipinfo.io/json

Replace HOST, PORT, USERNAME and PASSWORD with the values from My assets.

Common errors

• 407 Proxy Authentication Required. The proxy rejected the username or password, or none was sent. Set them in the URL or with --proxy-user and --proxy-password, and check the percent-encoding.

• Connection refused. Wrong HOST or PORT, or the lease has ended. Test the same address with the curl command above. The startup file command retry_connrefused = on makes Wget treat a refused connection as a temporary error and try again.

• Wget goes direct. Check for no_proxy, use_proxy = off in .wgetrc, or a --no-proxy in an alias.

• An https:// download ignores the proxy. Make sure https_proxy is set, not only http_proxy.

How to do it with Proxy302

Every command here needs only the host, port, username and password of a Proxy302 proxy. Wget takes an HTTP address, so choose HTTP when you generate the proxy. Rotating residential traffic is billed per GB and the exit country is set when you generate the proxy; HTTP is on port 2222 and SOCKS5 on port 3333 of proxy.proxy302.com. A static ISP IP stays fixed for the whole lease and does not rotate, which suits a tool that you want to always leave from the same address. HTTP or SOCKS5 is chosen when you buy, and one IP carries one protocol.

How to do it with Proxy302: steps

  1. Step 1

    Open the rotating residential page, choose the line, keep Protocol on HTTP, then click Review cost and generate.

  2. Step 2

    Open My assets (the console page that holds everything you bought) and copy HOST, PORT, USERNAME and PASSWORD. The Connect page shows a ready example with your own endpoint.

  3. Step 3

    Put the values into the commands above.

  4. Step 4

    Confirm the exit with https://ipinfo.io/json through the proxy.

  5. Step 5

    From mainland China, open the Helper from the Connect page, click 「一键加速」 (One-click boost) and keep it open while you use the proxy.

Prices and limits

The Budget line costs US$1.50 per GB, US$1.35 per GB in a 100 GB package and US$1.20 per GB at 300 GB. A static ISP IP costs US$0.50 for one day and US$7.99 for 30 days. There is no free trial, and the smallest purchase is 1 GB or one IP for one day. Which exit locations are available changes daily.

FAQ

Which variable does Wget read for https:// links?

https_proxy. The manual says http_proxy and https_proxy hold the proxy URLs for HTTP and HTTPS connections respectively.

Does the proxy URL itself start with https://?

For a Proxy302 HTTP proxy write http://HOST:PORT/ in both variables. The word in https_proxy only says which kind of downloads it is used for.

Can I use a SOCKS5 proxy with Wget?

The manual page about proxies does not mention SOCKS. Use an HTTP proxy address.

Does the setting stay after I close the terminal?

Environment variables do not; lines in .wgetrc do.

Reference links

6
  1. GNU Wget Manual: Proxies

    Official documentation · Confirmed on:

    Wget 1.25.0 manual, node Proxies: Wget supports proxies for HTTP and FTP retrievals; the standard way is the variables http_proxy, https_proxy (URLs of proxies for HTTP and HTTPS connections), ftp_proxy and no_proxy (comma-separated list of domain extensions proxy should not be used for; .mit.edu example); --no-proxy / "proxy = on/off" suppress the proxy even if variables are set; startup-file http_proxy, https_proxy, ftp_proxy and no_proxy override the environment; proxy authorization supports only the Basic scheme; username and password go in the proxy URL (http://hniksic:[email protected]:8001/) or in proxy-user and proxy-password / proxy_user and proxy_password. Checked on 2 November 2026 against the official release documentation (doc/wget.texi in wget-1.25.0.tar.gz from https://ftp.gnu.org/gnu/wget/, released 2024-11-10), because www.gnu.org could not be reached; the gnu.org manual page is the same text.

    The page does not mention SOCKS or percent-encoding of special characters.

  2. GNU Wget Manual: Wgetrc Commands

    Official documentation · Confirmed on:

    Node Wgetrc Commands. Checked on 2 November 2026 against the official release documentation (doc/wget.texi in wget-1.25.0.tar.gz from https://ftp.gnu.org/gnu/wget/, released 2024-11-10), because www.gnu.org could not be reached; the gnu.org manual page is the same text. http_proxy and https_proxy "instead of the one specified in environment"; no_proxy is a comma-separated list of domains for which no proxy is loaded; proxy_user and proxy_password set proxy authentication; use_proxy = off means do not use a proxy even when proxy-related environment variables are set, same as --no-proxy; retry_connrefused = on considers "connection refused" a transient error; output_document = file is the same as -O file; quiet = on/off is the same as -q.

    The commands are described one by one; the file location is in the Wgetrc Location node (next source).

  3. GNU Wget Manual: HTTP Options

    Official documentation · Confirmed on:

    Node HTTP Options. Checked on 2 November 2026 against the official release documentation (doc/wget.texi in wget-1.25.0.tar.gz from https://ftp.gnu.org/gnu/wget/, released 2024-11-10), because www.gnu.org could not be reached; the gnu.org manual page is the same text. --proxy-user=user and --proxy-password=password specify the username and password for authentication on a proxy server; Wget encodes them with the basic authentication scheme; security considerations similar to --http-password apply.

    It says nothing about SOCKS.

  4. GNU Wget Manual: Wgetrc Location

    Official documentation · Confirmed on:

    Node Wgetrc Location. Checked on 2 November 2026 against the official release documentation (doc/wget.texi in wget-1.25.0.tar.gz from https://ftp.gnu.org/gnu/wget/, released 2024-11-10), because www.gnu.org could not be reached; the gnu.org manual page is the same text. Global file /usr/local/etc/wgetrc by default; then the file named by WGETRC if set, else $HOME/.wgetrc; the user file overrides the global one. The Overview node adds --config and --no-config.

    It does not describe Windows locations.

  5. GNU Wget Manual: URL Format

    Official documentation · Confirmed on:

    Node URL Format. Checked on 2 November 2026 against the official release documentation (doc/wget.texi in wget-1.25.0.tar.gz from https://ftp.gnu.org/gnu/wget/, released 2024-11-10), because www.gnu.org could not be reached; the gnu.org manual page is the same text. Unsafe characters in a URL can be written as %xy; % is %25, : is %3A, @ is %40.

    It is about the URLs given to Wget, not specifically proxy URLs.

  6. Proxy302 product facts and price list

    Product observation · Confirmed on:

    Product facts file of the site (values checked against the console, the backend and the price table on 18-19 October 2026): products, prices in US$ (1 PTC = US$1), lease terms, protocols and ports, countries, quantity limits, no free trial.

Ready to try it?

Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.