Environment variables
Set HTTPS_PROXY, HTTP_PROXY, ALL_PROXY and NO_PROXY for NyxonProxies on Linux, macOS and Windows, and learn which tools read them and which patterns work.
Most command-line tools and HTTP libraries can take the proxy from environment variables. Set them once and every tool in that shell uses NyxonProxies, with no change to your code. The catch is that tools disagree on the details, so this page sticks to settings that work everywhere.
The variables
| Variable | Used for |
|---|---|
HTTPS_PROXY | Requests to https:// URLs |
HTTP_PROXY | Requests to http:// URLs |
ALL_PROXY | A fallback for any scheme, read by some tools only |
NO_PROXY | Hosts that skip the proxy, separated by commas |
The value is the address of the gateway. For the HTTP port it starts with http://, even in HTTPS_PROXY: the client asks the gateway for a tunnel and runs TLS to the site inside it. Writing https:// there makes the client try TLS with the gateway itself, which fails.
Linux and macOS
export https_proxy="http://USERNAME:[email protected]:8080"
export HTTPS_PROXY="$https_proxy"
export http_proxy="$https_proxy"
export HTTP_PROXY="$https_proxy"
export no_proxy="localhost,127.0.0.1,::1"
export NO_PROXY="$no_proxy"
curl https://api.ipify.orgTools disagree on whether the upper-case or the lower-case name wins, so set both to the same value. Add the lines to ~/.bashrc or ~/.zshrc to keep them for new shells.
Windows
In PowerShell, for the current window:
$env:HTTPS_PROXY = "http://USERNAME:[email protected]:8080"
$env:HTTP_PROXY = $env:HTTPS_PROXY
curl.exe https://api.ipify.orgIn Command Prompt, for the current window:
set HTTPS_PROXY=http://USERNAME:[email protected]:8080
set HTTP_PROXY=%HTTPS_PROXY%
curl https://api.ipify.orgWindows ignores the case of variable names, so one of each is enough. To keep a variable for future windows, use setx. It does not change the window you run it in:
setx HTTPS_PROXY "http://USERNAME:[email protected]:8080"Which tools read them
| Tool | Reads the variables |
|---|---|
| curl | Yes |
| Python Requests, HTTPX and urllib | Yes |
| Python aiohttp | Only with trust_env=True |
Node.js fetch and https | Only with NODE_USE_ENV_PROXY=1 or --use-env-proxy |
| axios | Yes |
Go net/http | Yes, through the default client |
| git, pip, npm | Yes |
Browsers use their own or the system proxy settings instead. See the guides under Browsers and devices in the sidebar.
Rules that work everywhere
- Always set
HTTPS_PROXY. With onlyHTTP_PROXYset, most clients send requests to HTTPS sites directly, from your own IP. - Do not rely on
ALL_PROXY. curl, Requests, HTTPX and git use it; aiohttp, urllib, Node.js and Go ignore it. - Write
NO_PROXYdomains with a leading dot..example.comworks in every client.*.example.comis ignored by most of them. - List local addresses one by one.
localhostdoes not cover127.0.0.1, and ranges such as127.0.0.0/8work in some tools only. Uselocalhost,127.0.0.1,::1. - Remember the lower case for curl. curl reads
http_proxyonly in lower case. - Percent-encode special characters in the password, such as
@as%40, or change the proxy password.
Tools with their own setting
Some tools also have a setting of their own, handy when only one tool should use the proxy.
git, with Basic authentication sent straight away:
git config --global http.proxy http://USERNAME:[email protected]:8080
git config --global http.proxyAuthMethod basicgit config --global --unset http.proxy removes the setting again.
pip, for one command:
pip install --proxy http://USERNAME:[email protected]:8080 requestsnpm:
npm config set https-proxy http://USERNAME:[email protected]:8080Check that it works
A skipped proxy fails silently: the request just leaves from your own IP. After any change, run curl https://api.ipify.org in the same shell and check that the address is not yours.
Last updated
Still stuck?
People answer the live chat around the clock. Send the proxy line you used (without the password) and the error you see.