wget Proxy Setup
wget is the standard command-line tool for downloading files and testing HTTP connectivity on Linux and macOS. It supports proxy configuration through environment variables, command-line flags, and the `~/.wgetrc` configuration file. Using wget with Hex Proxies is the fastest way to verify proxy connectivity, test geo-targeting, and download files through residential IPs from the command line.
Environment Variable Configuration
The simplest approach — set environment variables and all wget commands use the proxy:
export http_proxy=http://user:pass@gate.hexproxies.com:8080# Verify proxy connectivity wget -qO- https://httpbin.org/ip
# Download a file through the proxy wget https://example.com/file.zip ```
Command-Line Proxy Flags
For one-off commands without setting environment variables:
# Use -e to pass proxy settings inline
wget -e use_proxy=yes \
-e http_proxy=http://user:pass@gate.hexproxies.com:8080 \
-e https_proxy=http://user:pass@gate.hexproxies.com:8080 \
https://example.com/page.htmlPersistent Configuration via .wgetrc
For regular proxy usage, add settings to `~/.wgetrc`:
use_proxy = on
http_proxy = http://user:pass@gate.hexproxies.com:8080
https_proxy = http://user:pass@gate.hexproxies.com:8080
proxy_user = user
proxy_password = passGeo-Targeted Downloads
Test content from specific countries by modifying the proxy username:
# Download as a UK user
export https_proxy=http://user-country-gb:pass@gate.hexproxies.com:8080# Download as a German user export https_proxy=http://user-country-de:pass@gate.hexproxies.com:8080 wget -qO- https://example.com/pricing ```
Debugging Proxy Connections
Use wget's verbose and debug modes to inspect the proxy connection:
# Verbose output shows proxy handshake# Save response headers for analysis wget -S --spider https://example.com 2>&1 ```
Common Pitfalls
wget does not handle proxy authentication with special characters in passwords by default. URL-encode special characters in the password, or use the `--proxy-user` and `--proxy-password` flags separately. If wget hangs on HTTPS requests through the proxy, ensure you are using `http://` (not `https://`) in the proxy URL — the proxy handles the TLS connection to the target.
Recursive Downloads Through Proxy
wget's recursive download mode (`-r`) works through proxies for mirroring sites:
wget -r --level=2 --wait=2 -e https_proxy=http://user:pass@gate.hexproxies.com:8080 https://example.com/docs/Add `--wait=2` to space requests 2 seconds apart, respecting rate limits through the proxy.
Bandwidth and Timeout Considerations
Residential proxies add 200-500ms latency per request. Set wget's timeout values accordingly: `--timeout=30` for the overall request and `--connect-timeout=15` for the initial proxy handshake. For large file downloads through the proxy, the unlimited bandwidth of residential plans means download speed depends on the exit IP's connection quality rather than any proxy-imposed limit.
When to Use wget vs curl
wget excels at recursive downloads and site mirroring through proxies. curl is better for single requests with complex headers, JSON payloads, or API testing. For scripting pipelines, wget's `-q` (quiet) and `-O-` (stdout output) flags integrate cleanly with shell pipelines through the proxy.