How to Bypass Proxy for Specific Domains in aria2?
To configure aria2 to bypass a proxy for specific domains or IP
addresses, you must use the no-proxy option in your
configuration file or via the command line. While aria2 allows you to
route your download traffic through HTTP, HTTPS, or FTP proxies, certain
local or trusted network addresses often need to be accessed directly.
By defining a comma-separated list of domains, hostnames, or IP
addresses within the no-proxy setting, you can ensure that
aria2 selectively routes traffic, maintaining high-speed local transfers
while securing external downloads.
Understanding the
no-proxy Option
The primary mechanism for excluding specific traffic from your proxy
settings in aria2 is the --no-proxy command-line option,
which can also be permanently saved in your aria2.conf file
as no-proxy=.
This setting accepts a comma-separated list of hosts that should be
connected to directly, completely bypassing any proxies specified by
options like --http-proxy, --https-proxy, or
--ftp-proxy.
Step-by-Step
Configuration Via aria2.conf
Modifying the configuration file is the most efficient method for persistent settings. Follow these steps to implement the bypass:
- Locate or create your aria2 configuration file (typically named
aria2.conf). - Open the file in a text editor.
- Add or modify the
no-proxyline, followed by the specific domains or IP addresses you wish to exempt.
An example configuration block looks like this:
# Proxy Settings
http-proxy=http://proxy.example.com:8080
https-proxy=http://proxy.example.com:8080
# Proxy Bypass List
no-proxy=localhost,127.0.0.1,192.168.1.0/24,internal-domain.local,.example.com
Syntax and Wildcard Rules
When formatting your bypass list, keep the following syntax behaviors in any aria2 configuration mind:
- Exact Matches: Inputting
internal-domain.localwill bypass the proxy strictly for that exact hostname. - Domain Suffixes (Wildcards): To match a domain and
all of its subdomains, precede the domain name with a dot. For example,
.example.comwill matchexample.com,api.example.com, anddownload.example.com. - IP Ranges and Subnets: You can specify individual
IP addresses like
127.0.0.1or specify entire local network subnets using CIDR notation, such as192.168.1.0/24.
Using the Command Line Interface
If you only need to bypass the proxy for a single execution or a specific download script, you can pass the option directly into your terminal execution command:
aria2c --http-proxy="http://proxy.example.com:8080" --no-proxy="localhost,127.0.0.1,.local-network.lan" "http://example.com/file.zip"Verifying and Troubleshooting
If aria2 continues to route bypassed traffic through your proxy, verify the following elements:
- Environment Variables: aria2 respects system
environment variables. If
no_proxy(lowercase) orNO_PROXY(uppercase) is set in your operating system environment, ensure it matches the syntax required by aria2, or explicitly override it using the configuration file. - Trailing Spaces: Ensure there are no spaces after
the commas in your
no-proxystring configuration, as aria2 parses the string strictly. Usedomain1.com,domain2.cominstead ofdomain1.com, domain2.com.