How to set (and unset) an HTTP or SOCKS proxy for every common developer tool, in one page. Copy the line you need.
In the examples, replace the proxy with yours:
http://USER:PASS@proxy.example.com:8080
If the password contains @ : / # ? or %, URL-encode it (@ becomes %40, : becomes %3A), or the tool will split the URL in the wrong place.
Environment variables · cURL · wget · git · npm, yarn, pnpm · pip · conda · Go · Maven · Gradle · Java · Docker · apt · dnf and yum · SSH · Windows · macOS · Linux desktop · VS Code · Code
Most command-line tools read these.
# Linux and macOS (bash, zsh)
export HTTP_PROXY="http://USER:PASS@proxy.example.com:8080"
export HTTPS_PROXY="$HTTP_PROXY"
export NO_PROXY="localhost,127.0.0.1,.internal.example"
export http_proxy="$HTTP_PROXY" https_proxy="$HTTPS_PROXY" no_proxy="$NO_PROXY"
# remove
unset HTTP_PROXY HTTPS_PROXY NO_PROXY http_proxy https_proxy no_proxy# Windows PowerShell (this session)
$env:HTTP_PROXY = "http://USER:PASS@proxy.example.com:8080"
$env:HTTPS_PROXY = $env:HTTP_PROXY
$env:NO_PROXY = "localhost,127.0.0.1"
# Windows, permanent for your user (new terminals)
setx HTTPS_PROXY "http://USER:PASS@proxy.example.com:8080":: Windows cmd (this session)
set HTTPS_PROXY=http://USER:PASS@proxy.example.com:8080- Set both cases: some tools read only lowercase (
http_proxyfor cURL), others only uppercase. HTTPS_PROXYis the proxy for https websites. Its value is still usuallyhttp://...: the tool opens a tunnel to the proxy and TLS runs inside it.ALL_PROXY=socks5h://...sets a SOCKS proxy for tools that support it (cURL, git with libcurl).
curl -x http://proxy.example.com:8080 -U "USER:PASS" https://ipinfo.io/json
curl -x socks5h://USER:PASS@proxy.example.com:1080 https://ipinfo.io/json
curl --noproxy "*" https://example.com # ignore proxy variables onceEverything else about cURL and proxies: curl-proxy.
wget -e use_proxy=yes -e https_proxy=http://proxy.example.com:8080 \
--proxy-user=USER --proxy-password=PASS https://example.com/file.zip
wget --no-proxy https://example.com/file.zipPermanent, in ~/.wgetrc:
use_proxy = on
http_proxy = http://USER:PASS@proxy.example.com:8080
https_proxy = http://USER:PASS@proxy.example.com:8080
git config --global http.proxy http://USER:PASS@proxy.example.com:8080
# only for one host
git config --global http.https://github.com.proxy http://USER:PASS@proxy.example.com:8080
# SOCKS5
git config --global http.proxy socks5h://USER:PASS@proxy.example.com:1080
# check and remove
git config --global --get http.proxy
git config --global --unset http.proxy
# one command only
git -c http.proxy=http://USER:PASS@proxy.example.com:8080 clone https://github.com/fusion-proxy/proxy-checker.githttp.proxycovers bothhttp://andhttps://remotes.https.proxyis not a git setting; git ignores it.- git also uses
HTTPS_PROXYfrom the environment. http.proxydoes not apply togit@github.com:(SSH) remotes; see SSH.
# npm (pnpm reads the same settings)
npm config set proxy http://USER:PASS@proxy.example.com:8080
npm config set https-proxy http://USER:PASS@proxy.example.com:8080
npm config delete proxy
npm config delete https-proxy
# one command
npm install express --proxy=http://proxy.example.com:8080 --https-proxy=http://proxy.example.com:8080
# Yarn 1
yarn config set proxy http://USER:PASS@proxy.example.com:8080
yarn config set https-proxy http://USER:PASS@proxy.example.com:8080
# Yarn 2+ (Berry)
yarn config set httpProxy http://USER:PASS@proxy.example.com:8080
yarn config set httpsProxy http://USER:PASS@proxy.example.com:8080The npm settings live in ~/.npmrc, so the password is stored in plain text there.
pip install requests --proxy http://USER:PASS@proxy.example.com:8080Permanent, in pip.conf (~/.config/pip/pip.conf on Linux, ~/Library/Application Support/pip/pip.conf on macOS, %APPDATA%\pip\pip.ini on Windows):
[global]
proxy = http://USER:PASS@proxy.example.com:8080pip also reads HTTPS_PROXY. For SOCKS, install pysocks first.
~/.condarc:
proxy_servers:
http: http://USER:PASS@proxy.example.com:8080
https: http://USER:PASS@proxy.example.com:8080go get and module downloads use HTTPS_PROXY:
HTTPS_PROXY=http://USER:PASS@proxy.example.com:8080 go mod downloadGOPROXY is something else: the module mirror Go downloads from (https://proxy.golang.org), not a network proxy.
~/.m2/settings.xml:
<settings>
<proxies>
<proxy>
<id>default</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>USER</username>
<password>PASS</password>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
</settings>~/.gradle/gradle.properties:
systemProp.http.proxyHost=proxy.example.com
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=USER
systemProp.http.proxyPassword=PASS
systemProp.https.proxyHost=proxy.example.com
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=USER
systemProp.https.proxyPassword=PASS
systemProp.http.nonProxyHosts=localhost|127.0.0.1java -Dhttps.proxyHost=proxy.example.com -Dhttps.proxyPort=8080 \
-Dhttp.proxyHost=proxy.example.com -Dhttp.proxyPort=8080 \
-Djdk.http.auth.tunneling.disabledSchemes= -jar app.jarJava has no system property for the proxy password; set an Authenticator in code. jdk.http.auth.tunneling.disabledSchemes= is needed for Basic proxy authentication on HTTPS URLs. Example: ProxyExample.java.
Three different places, for three different things.
Pulling images (the Docker daemon). Docker Engine 23 and newer, /etc/docker/daemon.json:
{
"proxies": {
"http-proxy": "http://USER:PASS@proxy.example.com:8080",
"https-proxy": "http://USER:PASS@proxy.example.com:8080",
"no-proxy": "localhost,127.0.0.1"
}
}Older engines use a systemd drop-in, /etc/systemd/system/docker.service.d/http-proxy.conf:
[Service]
Environment="HTTP_PROXY=http://USER:PASS@proxy.example.com:8080"
Environment="HTTPS_PROXY=http://USER:PASS@proxy.example.com:8080"
Environment="NO_PROXY=localhost,127.0.0.1"Then sudo systemctl daemon-reload && sudo systemctl restart docker. Docker Desktop: Settings, Resources, Proxies.
Inside containers and builds (your client), ~/.docker/config.json:
{
"proxies": {
"default": {
"httpProxy": "http://USER:PASS@proxy.example.com:8080",
"httpsProxy": "http://USER:PASS@proxy.example.com:8080",
"noProxy": "localhost,127.0.0.1"
}
}
}One build only:
docker build --build-arg HTTPS_PROXY=http://USER:PASS@proxy.example.com:8080 ./etc/apt/apt.conf.d/95proxy:
Acquire::http::Proxy "http://USER:PASS@proxy.example.com:8080/";
Acquire::https::Proxy "http://USER:PASS@proxy.example.com:8080/";
One command: sudo apt -o Acquire::https::Proxy="http://proxy.example.com:8080/" update. Note that sudo does not pass your HTTPS_PROXY variable on by default.
/etc/dnf/dnf.conf (or /etc/yum.conf), under [main]:
proxy=http://proxy.example.com:8080
proxy_username=USER
proxy_password=PASSSSH does not read proxy variables. Use ProxyCommand in ~/.ssh/config:
# through an HTTP proxy with a password (ncat comes with nmap)
Host server.example.com
ProxyCommand ncat --proxy proxy.example.com:8080 --proxy-type http --proxy-auth USER:PASS %h %p
# through a SOCKS5 proxy without a password (OpenBSD netcat)
Host server.example.com
ProxyCommand nc -X 5 -x proxy.example.com:1080 %h %p
The proxy must allow tunnels to port 22. Git over SSH (git@github.com:) uses the same config; GitHub also accepts SSH on ssh.github.com port 443 if only web ports are allowed.
- System proxy (browsers and most apps): Settings, Network & internet, Proxy, Manual proxy setup.
- WinHTTP (Windows services and some updaters):
netsh winhttp set proxy proxy.example.com:8080 "localhost;127.0.0.1"andnetsh winhttp reset proxy. - PowerShell:
Invoke-WebRequest https://ipinfo.io/json -Proxy http://proxy.example.com:8080 -ProxyCredential (Get-Credential).
networksetup -setsecurewebproxy "Wi-Fi" proxy.example.com 8080 on USER PASS
networksetup -setwebproxy "Wi-Fi" proxy.example.com 8080 on USER PASS
networksetup -setsecurewebproxystate "Wi-Fi" off # turn off
networksetup -listallnetworkservices # names like "Wi-Fi", "Ethernet"Or System Settings, Network, your connection, Details, Proxies.
gsettings set org.gnome.system.proxy mode 'manual'
gsettings set org.gnome.system.proxy.https host 'proxy.example.com'
gsettings set org.gnome.system.proxy.https port 8080
gsettings set org.gnome.system.proxy mode 'none' # turn offsettings.json:
{
"http.proxy": "http://USER:PASS@proxy.example.com:8080",
"http.proxySupport": "override"
}| Language | Guide |
|---|---|
| Python requests | python-requests-proxy |
| Node.js (fetch, axios) | nodejs-proxy |
| Go, PHP, Java, C#, Ruby | fusionproxy examples |
| Playwright, Puppeteer, Selenium | playwright-proxy, puppeteer-proxy, selenium-proxy |
| Scrapy | scrapy-proxy-middleware |
curl https://ipinfo.io/ip # with the proxy variables set, this prints the proxy's IPOr open the what is my IP page, or test a proxy with the online proxy checker and the proxy-checker CLI.
The git, npm, pip, Go and cURL commands on this page were run against a live proxy in November 2026. Spotted a tool that is missing or a setting that changed? Open an issue or a pull request.
Need a proxy? Fusion Proxy has residential, ISP and datacenter proxies with HTTP(S) and SOCKS5, and a free trial.
MIT, see LICENSE.