How to Disable Proxy in Wget?
When downloading files via the command line, you might occasionally
need to bypass your system’s configured proxy settings to connect
directly to a server. This quick guide explains exactly which option
tells wget to ignore all proxy environment variables,
provides clear syntax examples, and covers how to make this behavior
permanent for specific domains.
The Short Answer:
--no-proxy
To force wget to ignore all proxy environment variables
(such as http_proxy or https_proxy) and
establish a direct connection to the target server, you must use the
--no-proxy option.
Basic Syntax
wget --no-proxy http://example.com/file.zipBy adding this flag, wget completely bypasses any proxy
servers defined in your system environment or configuration files for
that specific command execution.
Alternative: Bypassing Proxies for Specific Domains
If you don’t want to disable the proxy for every single download, but
only want to bypass it for specific local or internal domains, you don’t
need to use the --no-proxy flag every time. Instead, you
can utilize the no_proxy environment variable.
Using the
no_proxy Environment Variable
The no_proxy variable accepts a comma-separated list of
domain suffixes or IP addresses that should always be connected to
directly.
export no_proxy="localhost,127.0.0.1,internal.domain.local"
wget http://internal.domain.local/data.txtIn this scenario, wget will still use your proxy for
external websites, but will automatically bypass it when communicating
with the addresses listed in the no_proxy variable.
Making the Change Permanent in .wgetrc
If you want wget to never use a proxy by
default, you can hardcode this preference into your personal
wget configuration file.
- Open or create the
~/.wgetrcfile in your home directory. - Add the following line to the file:
use_proxy = off
Saving this setting ensures that wget behaves as if the
--no-proxy flag is permanently turned on, allowing you to
run standard wget commands without manually typing the
option every time.