- Host
- gw.prokso.com
- Port
- 823 HTTP · 824 SOCKS5 - new IP per request · 10000–20000 sticky session, HTTP(S) and SOCKS5
- Username and password
- in your dashboard, on the plan page
Your dashboard generates ready-made lines in the format you need: choose the country, IP type and protocol.
- Wget takes the proxy from -e, ~/.wgetrc or the http_proxy / https_proxy variables
- Keep the password in ~/.wgetrc with chmod 600, not on the command line
- HTTP ports only (823 or sticky): the Wget documentation does not describe SOCKS
GNU Wget learns about a proxy from three sources: environment variables, the .wgetrc file and command-line options. It sends the proxy password only with the Basic scheme, and its documentation does not describe SOCKS at all. So with Prokso, Wget works through the HTTP ports, and the main question is where to store the username and password so they do not show up in the command history.
Step 1. Prepare the proxy URL without the username for Wget
Wget expects the proxy address as a URL: http://gw.prokso.com:823/. You can add the username and password to it, but it is more convenient to pass them separately, with --proxy-user and --proxy-password or in .wgetrc.
Use the HTTP ports. 823 gives a new IP for every request, and for downloading a list of files that means a new address for every file. Ports 10000-20000 keep one address for 1 to 120 minutes, for when a site expects all downloads to come from one IP. Port 824 (SOCKS5) does not work for Wget.
The username and password are in the “Access” block on the plan page. The username sets the country, so to download from another country you only change the username.
Step 2. One command with -e and --proxy-user
wget -q -O - \
-e use_proxy=on \
-e https_proxy=http://gw.prokso.com:823/ \
--proxy-user=USERNAME --proxy-password=PASSWORD \
https://api.ipify.orgThe -e option runs a command as if it were written in .wgetrc, and it takes priority over the file. Here it turns on the proxy and sets its address for https sites. -q removes the service output, and -O - prints the response to the terminal instead of saving it to a file.
According to the documentation, Wget encodes --proxy-user and --proxy-password with the Basic scheme - it does not implement any other one for proxies. But a password on the command line is visible to anyone who runs ps, and it stays in the shell history. For a one-off check that is acceptable, for regular work it is not.
Step 3. Permanent settings in .wgetrc
# ~/.wgetrc
use_proxy = on
http_proxy = http://gw.prokso.com:10001/
https_proxy = http://gw.prokso.com:10001/
proxy_user = USERNAME
proxy_password = PASSWORD
no_proxy = localhost,127.0.0.1Wget reads $HOME/.wgetrc unless the WGETRC variable points to another file. The personal file overrides the system-wide one, which by default is located at /usr/local/etc/wgetrc. The proxy_user and proxy_password commands work the same way as the options with the same names.
The documentation recommends protecting this file from other users: run chmod 600 ~/.wgetrc. The example uses a sticky port, so all runs within the hold time go out from one address.
The http_proxy and https_proxy variables
The third way is lowercase environment variables: http_proxy and https_proxy contain the proxy URL for the corresponding protocols, and no_proxy is a comma-separated list of domains that bypass the proxy. Commands in .wgetrc with the same names take priority over the variables.
Variables are handy when Wget is launched by another program or script: other tools in the same shell will pick them up too. If the variables are set but you do not need the proxy for a particular run, add --no-proxy.
| Where to set it | What to write | Priority |
|---|---|---|
The -e option | -e https_proxy=… | Highest, only for this run |
~/.wgetrc | https_proxy = …, proxy_user, proxy_password | Overrides environment variables |
| Environment variables | https_proxy, http_proxy, no_proxy | Apply if nothing above is set |
Downloading from a list and retries
By default Wget makes 20 attempts and stops earlier only on fatal errors such as "connection refused" or 404. Through a rotating proxy you usually do not need that many retries, and the default read timeout is as long as 900 seconds.
# urls.txt - list of URLs, one per line
wget -i urls.txt \
--tries=3 --waitretry=5 \
--wait=2 --random-wait \
--connect-timeout=10 --read-timeout=30
echo $? # exit code: 0 means success--waitretry increases the pause between retries linearly, --wait sets the pause between files, and --random-wait makes it random, from half to one and a half times the value. By default --connect-timeout is not limited by anything except the system libraries, so it is worth setting it explicitly.
Keep in mind that traffic is counted in both directions. A large list of files through the proxy deducts the whole downloaded volume from the plan.
Wget exit codes and the proxy
Wget reports the result with an exit code, and for scripts this is the most reliable way to understand what happened with the proxy:
- 4 - network failure: a wrong proxy host or port, or access to
gw.prokso.comis blocked. - 5 - an error verifying the site's SSL certificate.
- 6 - username and password authentication error. Check the username, password and remaining traffic: when it runs out, the proxy refuses the same way (code 407).
- 8 - the server responded with an error, for example 403 or 429 from the site itself.
To see who exactly responded, add -S: Wget will print the response headers. The --no-check-certificate option turns certificate errors into warnings - you do not need it with a proxy, because the tunnel passes the site's certificate through unchanged.
Check: what the command prints
The command from step 2 prints one line - the IP the site sees the request from. Compare it with the machine's address: it should be different. Repeat the command: with port 823 the address will change, with a sticky port it will not.
The browser page What is my IP shows the browser's address, not Wget's. To check the line separately from the Wget settings, paste it into the proxy checker.
If the proxy does not work
FAQ
Does Wget work with SOCKS5?
The GNU Wget documentation only describes proxies for HTTP, HTTPS and FTP, and says nothing about SOCKS. Use HTTP port 823 or a sticky port; for SOCKS5 there is curl.
How do I keep the password out of the process list?
Do not pass it as an option: write proxy_user and proxy_password to ~/.wgetrc and run chmod 600 ~/.wgetrc. Or turn on the IP whitelist in the plan, then you do not need a password at all.
Why does Wget hang on one file for a long time?
The default read timeout is 900 seconds, with 20 attempts per file. Set --read-timeout, --connect-timeout and --tries to suit your needs.
How do I temporarily download direct without removing the variables?
Add --no-proxy to the command: Wget will ignore both the environment variables and the proxy settings.
Can I limit the speed so I do not use up all the traffic?
--limit-rate limits the speed (for example, --limit-rate=200k), but not the volume. To keep the volume in check, use a traffic limit in the plan settings: per hour, day or week.
Was this guide helpful?
Thanks for your feedback!
Sorry about that. Tell us which step you got stuck on and we will help.