An HTTP proxy forwards HTTP requests through an intermediary server so the origin host never sees the client’s real address. This indirection is common on corporate networks that enforce traffic filtering, caching, or egress auditing.
The wget command-line downloader honors the http_proxy and https_proxy environment variables or dedicated directives in .wgetrc. Both methods translate a URL such as `http://proxy.example.com:3128` into a transparent outbound connection for every subsequent fetch.
Proxy traversal adds one extra TCP handshake, so initial latency rises slightly while throughput remains unchanged. When the proxy terminates TLS on your behalf, ensure certificate pinning or checksum verification to detect tampering.
Steps to configure wget with an HTTP proxy:
- Record the proxy server’s host, port, and credentials supplied by your network administrator.
- Export the http_proxy environment variable in the current shell to route traffic through the proxy.
$ export http_proxy=http://proxy.example.com:3128
Use uppercase HTTP_PROXY on macOS or for legacy scripts that rely on capitalised names.
- Run wget against a known URL to confirm the proxy is reachable.
$ wget -qO- http://example.com/ <!doctype html><html>…</html>
- Create or edit ~/.wgetrc to persist the proxy setting across sessions.
use_proxy=yes http_proxy = http://proxy.example.com:3128/ https_proxy = http://proxy.example.com:3128/
- Add proxy_user and proxy_password lines to ~/.wgetrc when the proxy requires authentication.
proxy_user = alice proxy_password = S3cur3!
Store sensitive credentials in a dedicated .netrc file with mode 600 to avoid exposing them in plain text.
- Unset the http_proxy variable when direct connectivity is needed.
$ unset http_proxy

Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.