# curl --noproxy and NO_PROXY: Proxy Environment Variables Explained

Published 2026-11-26 · By Team CleanProxies · [Read on the web](https://www.cleanproxies.com/blogs/curl-noproxy)

> curl --noproxy and NO_PROXY decide which hosts skip the proxy. Real runs on curl, Python requests and Node show how matching, case and precedence work, plus Go rules.

`curl --noproxy` (and the `NO_PROXY` environment variable) gives curl a comma-separated list of hosts it must reach directly, even when a proxy is set with `-x`, `http_proxy`, `HTTPS_PROXY` or `ALL_PROXY`; `--noproxy '*'` turns the proxy off for everything. Most "my proxy is ignored" or "my internal API goes through the proxy" bugs come from three details: curl reads `http_proxy` only in lowercase, `NO_PROXY` matches host names as written in the URL (not the IP they resolve to), and Python, Node and Go each read the same variables a little differently.

If you need the proxy itself: CleanProxies [ISP proxies](https://www.cleanproxies.com/products/isp-proxies) are static US carrier IPs from $0.75/IP per month with HTTP(S) and SOCKS5, so they drop straight into `http_proxy` / `HTTPS_PROXY` and the commands below. Everything here also works with any other HTTP proxy.

Updated 26 November 2026. Every output block below is real (trimmed only where marked): it ran on 26 Nov 2026 with curl 7.68.0, Python requests 2.22.0 and 2.34.2, and Node.js v24.22.1, against a local test proxy on `127.0.0.1:8888` (the lab script is further down, so you can repeat every run). Each block ran in a fresh shell with no proxy variables set and no `~/.curlrc`. The Go section is an example built from the Go docs and source; it was not run.

## Quick reference

```bash
# Proxy for one command, with a bypass list for that command only
curl -x "http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT" \
     --noproxy "localhost,127.0.0.1,.internal.example.com" \
     https://api.ipify.org

# Proxy for the whole shell session
export http_proxy="http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT"   # lowercase only for curl
export HTTPS_PROXY="http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT"
export ALL_PROXY="socks5h://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT"  # fallback for other protocols
export NO_PROXY="localhost,127.0.0.1,.internal.example.com"

curl --noproxy '*' https://example.com    # ignore every proxy for this call
curl -x '' https://example.com             # same effect: empty proxy overrides the env
curl --noproxy '' -x "http://PROXY_HOST:PROXY_PORT" https://example.com   # ignore NO_PROXY, force the proxy
curl -q https://example.com                # -q first: skip ~/.curlrc (and any proxy set in it)
curl -sv https://example.com 2>&1 | grep -i proxy   # see which variable curl used
```

| Setting | What it does in curl | Source |
| --- | --- | --- |
| `-x` / `--proxy` | Proxy for this command; overrides proxy env variables; `-x ''` clears them | curl man page |
| `--noproxy <list>` | Hosts to reach directly; overrides `NO_PROXY`; `--noproxy ''` cancels `NO_PROXY` | curl man page |
| `http_proxy` | Proxy for `http://` URLs. **Lowercase only**: `HTTP_PROXY` is ignored | curl man page + run below |
| `HTTPS_PROXY` / `https_proxy` | Proxy for `https://` URLs (either case; lowercase wins) | curl man page |
| `ALL_PROXY` | Used when no protocol-specific variable is set | curl man page + run below |
| `NO_PROXY` / `no_proxy` | Bypass list; applies even to a proxy given with `-x`; lowercase wins | curl man page + run below |
| `~/.curlrc` | Can hold `proxy = ...` and `noproxy = ...`; skipped when `-q` is the first option | curl man page + run below |

For the basics of pointing curl at a proxy (auth, SOCKS5, HTTPS targets), see our [curl proxy](https://www.cleanproxies.com/integrations/curl) page. This post is about the other half: what curl does *not* send through the proxy, and why.

## How curl matches NO_PROXY entries (real output)

The curl man page says each entry is "matched as either a domain which contains the hostname, or the hostname itself", so `internal.test` matches `internal.test` and `api.internal.test` but not `notinternal.test`. Here is that rule on four host names, with six different `NO_PROXY` values. `--resolve` points the test names at the local origin so the direct path works; "via PROXY" lines were answered by the test proxy, "DIRECT" lines by the origin.

```bash
unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY ALL_PROXY all_proxy NO_PROXY no_proxy
export http_proxy=http://127.0.0.1:8888
R="--resolve api.internal.test:9000:127.0.0.1 --resolve www.internal.test:9000:127.0.0.1 \
   --resolve internal.test.evil.com:9000:127.0.0.1 --resolve notinternal.test:9000:127.0.0.1"
for nop in "" "internal.test" ".internal.test" "*" "127.0.0.0/8" "internal.test:9000"; do
  echo "== NO_PROXY='$nop'"
  for h in api.internal.test www.internal.test notinternal.test internal.test.evil.com; do
    printf "%-24s " "$h"; NO_PROXY="$nop" curl -s $R "http://$h:9000/"
  done
done
```

Output (curl 7.68.0, 26 Nov 2026):

```text
== NO_PROXY=''
api.internal.test        via PROXY  (request line: GET http://api.internal.test:9000/)
www.internal.test        via PROXY  (request line: GET http://www.internal.test:9000/)
notinternal.test         via PROXY  (request line: GET http://notinternal.test:9000/)
internal.test.evil.com   via PROXY  (request line: GET http://internal.test.evil.com:9000/)
== NO_PROXY='internal.test'
api.internal.test        DIRECT     (Host: api.internal.test:9000)
www.internal.test        DIRECT     (Host: www.internal.test:9000)
notinternal.test         via PROXY  (request line: GET http://notinternal.test:9000/)
internal.test.evil.com   via PROXY  (request line: GET http://internal.test.evil.com:9000/)
== NO_PROXY='.internal.test'
api.internal.test        DIRECT     (Host: api.internal.test:9000)
www.internal.test        DIRECT     (Host: www.internal.test:9000)
notinternal.test         via PROXY  (request line: GET http://notinternal.test:9000/)
internal.test.evil.com   via PROXY  (request line: GET http://internal.test.evil.com:9000/)
== NO_PROXY='*'
api.internal.test        DIRECT     (Host: api.internal.test:9000)
www.internal.test        DIRECT     (Host: www.internal.test:9000)
notinternal.test         DIRECT     (Host: notinternal.test:9000)
internal.test.evil.com   DIRECT     (Host: internal.test.evil.com:9000)
== NO_PROXY='127.0.0.0/8'
api.internal.test        via PROXY  (request line: GET http://api.internal.test:9000/)
www.internal.test        via PROXY  (request line: GET http://www.internal.test:9000/)
notinternal.test         via PROXY  (request line: GET http://notinternal.test:9000/)
internal.test.evil.com   via PROXY  (request line: GET http://internal.test.evil.com:9000/)
== NO_PROXY='internal.test:9000'
api.internal.test        via PROXY  (request line: GET http://api.internal.test:9000/)
www.internal.test        via PROXY  (request line: GET http://www.internal.test:9000/)
notinternal.test         via PROXY  (request line: GET http://notinternal.test:9000/)
internal.test.evil.com   via PROXY  (request line: GET http://internal.test.evil.com:9000/)
```

What the output shows:

- **Domain entries are suffix matches on name boundaries.** `internal.test` and `.internal.test` behaved the same here: both covered the subdomains, neither matched `notinternal.test` or `internal.test.evil.com`.
- **`*` is the only wildcard.** `*.internal.test` is not a curl pattern; write `.internal.test` or `internal.test`.
- **IP and CIDR entries match the URL, not DNS.** `127.0.0.0/8` did not bypass `api.internal.test` even though it resolved to 127.0.0.1: curl compares the host as written. On top of that, CIDR in `NO_PROXY` and `--noproxy` was added in curl 7.86.0, so on 7.68.0 even a literal IP URL still went through the proxy with a CIDR entry, while the exact IP sent it direct (output below). Check `curl --version` before you rely on CIDR.

```text
$ http_proxy=http://127.0.0.1:8888 NO_PROXY=127.0.0.1 curl -s http://127.0.0.1:9000/
DIRECT     (Host: 127.0.0.1:9000)
$ http_proxy=http://127.0.0.1:8888 NO_PROXY=127.0.0.0/8 curl -s http://127.0.0.1:9000/
via PROXY  (request line: GET http://127.0.0.1:9000/)
```

- **A port in the entry did not match on curl 7.68.0.** `internal.test:9000` sent everything through the proxy. Use bare host names unless your curl version documents port support.

The man page adds two rules worth knowing: international names must be written in punycode, and IPv6 addresses go into the list without brackets.

## Precedence: which setting wins (real output)

```bash
unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY ALL_PROXY all_proxy NO_PROXY no_proxy
R="--resolve api.internal.test:9000:127.0.0.1"
HTTP_PROXY=http://127.0.0.1:8888 curl -s $R http://api.internal.test:9000/                         # 1
http_proxy=http://127.0.0.1:8888 curl -s $R http://api.internal.test:9000/                         # 2
NO_PROXY=internal.test curl -s $R -x http://127.0.0.1:8888 http://api.internal.test:9000/          # 3
NO_PROXY=internal.test curl -s $R -x http://127.0.0.1:8888 --noproxy '' http://api.internal.test:9000/  # 4
http_proxy=http://127.0.0.1:8888 curl -s $R --noproxy '*' http://api.internal.test:9000/           # 5
http_proxy=http://127.0.0.1:8888 curl -s $R -x '' http://api.internal.test:9000/                   # 6
ALL_PROXY=http://127.0.0.1:8888 curl -s $R http://api.internal.test:9000/                          # 7
http_proxy=http://127.0.0.1:8888 no_proxy=other.test NO_PROXY=internal.test curl -s $R http://api.internal.test:9000/  # 8
```

Output (curl 7.68.0; the numbers were added to match the commands):

```text
1 DIRECT     (Host: api.internal.test:9000)
2 via PROXY  (request line: GET http://api.internal.test:9000/)
3 DIRECT     (Host: api.internal.test:9000)
4 via PROXY  (request line: GET http://api.internal.test:9000/)
5 DIRECT     (Host: api.internal.test:9000)
6 DIRECT     (Host: api.internal.test:9000)
7 via PROXY  (request line: GET http://api.internal.test:9000/)
8 via PROXY  (request line: GET http://api.internal.test:9000/)
```

1. Uppercase `HTTP_PROXY` alone did nothing: the man page lists `http_proxy` as "only available in lower case".
2. Lowercase `http_proxy` worked.
3. `NO_PROXY` beat `-x`: the man page says the variable "disables use of the proxy even when specified with the --proxy option".
4. `--noproxy ''` cancelled `NO_PROXY` and forced the proxy.
5. `--noproxy '*'` sent the request direct despite `http_proxy`.
6. `-x ''` cleared the proxy from the environment.
7. `ALL_PROXY` was used because no `http_proxy` was set.
8. With both spellings set, lowercase `no_proxy` (`other.test`) won, so `internal.test` was not bypassed.

### Debug it with curl -v

`curl -v` prints the variable it used. Two real runs (only the `*` and `>` lines kept):

```text
$ http_proxy=http://127.0.0.1:8888 curl -sv --resolve api.internal.test:9000:127.0.0.1 http://api.internal.test:9000/
* Uses proxy env variable http_proxy == 'http://127.0.0.1:8888'
*   Trying 127.0.0.1:8888...
* Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
> GET http://api.internal.test:9000/ HTTP/1.1

$ http_proxy=http://127.0.0.1:8888 NO_PROXY=internal.test curl -sv --resolve api.internal.test:9000:127.0.0.1 http://api.internal.test:9000/
* Uses proxy env variable NO_PROXY == 'internal.test'
*   Trying 127.0.0.1:9000...
* Connected to api.internal.test (127.0.0.1) port 9000 (#0)
```

Two tells: the "Uses proxy env variable" line names the variable, and the port after "Trying" is the proxy's port (8888) or the target's (9000). A full URL after `GET` means the request went to an HTTP proxy.

### .curlrc

A proxy can also live in `~/.curlrc` (curl checks `$CURL_HOME/.curlrc` first, and `$XDG_CONFIG_HOME/curlrc` from curl 7.73.0). That is a common reason for "curl uses a proxy and I never set one".

```text
# ~/.curlrc
proxy = "http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT"
noproxy = "localhost,127.0.0.1,.internal.example.com"
```

Our run, with a `.curlrc` holding only `proxy = "http://127.0.0.1:8888"` (`CURL_HOME` points curl at it; `$R` is the `--resolve` option from above):

```text
$ CURL_HOME=$PWD/h curl -s $R http://api.internal.test:9000/
via PROXY  (request line: GET http://api.internal.test:9000/)
$ CURL_HOME=$PWD/h curl -q -s $R http://api.internal.test:9000/
DIRECT     (Host: api.internal.test:9000)
$ CURL_HOME=$PWD/h NO_PROXY=internal.test curl -s $R http://api.internal.test:9000/
DIRECT     (Host: api.internal.test:9000)
```

`-q` as the first option skipped the file, and `NO_PROXY` in the environment still applied to a proxy set in `.curlrc`.

## NO_PROXY in Python requests (real output)

requests reads `http_proxy`, `https_proxy`, `no_proxy` and `all_proxy` in either case. Run this script from a shell with no proxy variables set (it sets them itself):

```python
import os
import requests

URL = "http://localhost:9000/"


def show(label, **kw):
    try:
        r = requests.get(URL, timeout=5, **kw)
        print(f"{label:<44} {r.text.strip()}")
    except requests.exceptions.RequestException as e:
        print(f"{label:<44} ERROR {type(e).__name__}")


os.environ["HTTP_PROXY"] = "http://127.0.0.1:8888"
show("HTTP_PROXY set, no NO_PROXY")
os.environ["NO_PROXY"] = "localhost"
show("NO_PROXY=localhost")
show("NO_PROXY=localhost + explicit proxies=",
     proxies={"http": "http://127.0.0.1:8888"})
s = requests.Session()
s.trust_env = False
r = s.get(URL, timeout=5)
print(f"{'trust_env=False':<44} {r.text.strip()}")
del os.environ["NO_PROXY"]
r = s.get(URL, timeout=5)
print(f"{'trust_env=False, NO_PROXY unset':<44} {r.text.strip()}")
show("proxies={'no_proxy': 'localhost'}",
     proxies={"http": "http://127.0.0.1:8888", "no_proxy": "localhost"})
os.environ["NO_PROXY"] = "127.0.0.0/8"
show("NO_PROXY=127.0.0.0/8, URL host localhost")
```

Output (identical on requests 2.22.0 and 2.34.2, 26 Nov 2026):

```text
HTTP_PROXY set, no NO_PROXY                  via PROXY  (request line: GET http://localhost:9000/)
NO_PROXY=localhost                           DIRECT     (Host: localhost:9000)
NO_PROXY=localhost + explicit proxies=       via PROXY  (request line: GET http://localhost:9000/)
trust_env=False                              DIRECT     (Host: localhost:9000)
trust_env=False, NO_PROXY unset              DIRECT     (Host: localhost:9000)
proxies={'no_proxy': 'localhost'}            via PROXY  (request line: GET http://localhost:9000/)
NO_PROXY=127.0.0.0/8, URL host localhost     via PROXY  (request line: GET http://localhost:9000/)
```

And more `NO_PROXY` forms (requests 2.34.2, same idea: set `HTTP_PROXY` and `NO_PROXY`, call `requests.get`):

```text
NO_PROXY=127.0.0.0/8      http://127.0.0.1:9000/   DIRECT     (Host: 127.0.0.1:9000)
NO_PROXY=localhost:9000   http://localhost:9000/   DIRECT     (Host: localhost:9000)
NO_PROXY=localhost:8080   http://localhost:9000/   via PROXY  (request line: GET http://localhost:9000/)
NO_PROXY=.localhost       http://localhost:9000/   DIRECT     (Host: localhost:9000)
NO_PROXY=*                http://localhost:9000/   DIRECT     (Host: localhost:9000)
```

Domain matching, checked with the helper requests itself uses:

```python
from requests.utils import should_bypass_proxies

for np_ in ["example.com", ".example.com", "*.example.com"]:
    for u in ["http://example.com/", "http://api.example.com/", "http://notexample.com/"]:
        print(f"no_proxy={np_:<15} {u:<26} bypass={should_bypass_proxies(u, no_proxy=np_)}")
```

```text
no_proxy=example.com     http://example.com/        bypass=True
no_proxy=example.com     http://api.example.com/    bypass=True
no_proxy=example.com     http://notexample.com/     bypass=False
no_proxy=.example.com    http://example.com/        bypass=True
no_proxy=.example.com    http://api.example.com/    bypass=True
no_proxy=.example.com    http://notexample.com/     bypass=False
no_proxy=*.example.com   http://example.com/        bypass=False
no_proxy=*.example.com   http://api.example.com/    bypass=False
no_proxy=*.example.com   http://notexample.com/     bypass=False
```

What that means for your code:

- **A proxy passed in code beat the bypass list.** With `proxies={"http": ...}` on the call, neither `NO_PROXY` nor a `no_proxy` key inside `proxies` stopped that proxy in our runs. The bypass list controls proxies picked up from the environment. If you need a bypass list, leave the proxy in the environment, or skip `proxies=` for internal hosts yourself.
- **`trust_env = False` stops the session reading proxy variables** (and other environment settings such as `.netrc` credentials). Proxies you set yourself on the session or the call still apply; with none set, it is a clean "no proxy here" switch.
- **CIDR works for IP addresses, not names.** `127.0.0.0/8` bypassed `http://127.0.0.1:9000/` but not `http://localhost:9000/`.
- **Domain entries: `example.com` and `.example.com` both matched `example.com` and `api.example.com`, and `*.example.com` matched nothing.**
- **Ports matter in requests.** `localhost:9000` bypassed only port 9000; `localhost:8080` did not match a request to port 9000.
- requests does **not** skip localhost on its own: with no `NO_PROXY`, `localhost` went through the proxy. Add `localhost,127.0.0.1` to `NO_PROXY` in dev environments.

The [socks5h guide](https://www.cleanproxies.com/blogs/socks5h) covers the SOCKS side (`ALL_PROXY=socks5h://...` needs `pip install "requests[socks]"`).

## NO_PROXY in Node.js (real output)

Node's built-in `http`, `https` and `fetch` ignore proxy variables unless you opt in. Node 24.5.0 and 22.21.0 added built-in proxy support (marked "Stability: 1.1 - Active development" in the Node docs): set `NODE_USE_ENV_PROXY=1` or start Node with `--use-env-proxy`. The in-code switch `http.setGlobalProxyFromEnv()` came later, in v24.14.0 and v25.4.0. Lowercase variables win over uppercase. Test script:

```javascript
// node_test.mjs
import http from 'node:http';

const get = (url) => new Promise((resolve) => {
  http.get(url, (res) => {
    let b = '';
    res.on('data', (c) => (b += c));
    res.on('end', () => resolve(b.trim()));
  }).on('error', (e) => resolve('ERROR ' + e.code));
});

const f = async (url) => {
  try {
    return (await (await fetch(url)).text()).trim();
  } catch (e) {
    return 'ERROR ' + (e.cause?.code || e.message);
  }
};

console.log('http.get  ', await get('http://localhost:9000/'));
console.log('fetch     ', await f('http://localhost:9000/'));
```

Output (Node v24.22.1, 26 Nov 2026; the bracketed line is what the test proxy logged during that run):

```text
$ HTTP_PROXY=http://127.0.0.1:8888 node node_test.mjs
http.get   DIRECT     (Host: localhost:9000)
fetch      DIRECT     (Host: localhost:9000)

$ NODE_USE_ENV_PROXY=1 HTTP_PROXY=http://127.0.0.1:8888 node node_test.mjs
http.get   via PROXY  (request line: GET http://localhost:9000/)
fetch      DIRECT     (Host: localhost:9000)
  [proxy log: CONNECT localhost:9000]

$ NODE_USE_ENV_PROXY=1 HTTP_PROXY=http://127.0.0.1:8888 NO_PROXY=localhost node node_test.mjs
http.get   DIRECT     (Host: localhost:9000)
fetch      DIRECT     (Host: localhost:9000)

$ NODE_USE_ENV_PROXY=1 HTTP_PROXY=http://127.0.0.1:8888 NO_PROXY=localhost:8080 node node_test.mjs
http.get   via PROXY  (request line: GET http://localhost:9000/)
fetch      DIRECT     (Host: localhost:9000)
  [proxy log: CONNECT localhost:9000]
```

Read the `fetch` lines with the proxy log next to them. With `NODE_USE_ENV_PROXY=1`, `fetch` **did** use the proxy, but through a `CONNECT` tunnel even for an `http://` URL, so the origin answered through the tunnel and printed "DIRECT". `http.get` sent the full URL to the proxy instead. So `fetch` needs a proxy that accepts `CONNECT`, also for plain-HTTP targets. Without the opt-in, neither one touched the proxy.

`NO_PROXY=localhost` bypassed both; `localhost:8080` did not match port 9000. Our runs covered only `localhost` and `localhost:port`. For the rest, the Node docs list these `NO_PROXY` forms: `*`, `example.com` (exact host), `.example.com` (subdomains), `*.example.com`, an exact IP, an IP range such as `192.168.1.1-192.168.1.100`, and `host:port`. Libraries such as axios or got have their own proxy logic; see the [Node.js proxy](https://www.cleanproxies.com/integrations/nodejs) page for agent-based setups.

## NO_PROXY in Go (example, not run)

Go's `http.ProxyFromEnvironment` (the default for `http.DefaultTransport`) reads `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` or their lowercase forms. In the standard library's copy of `httpproxy` (go.dev source read 26 Nov 2026) the **uppercase** name is checked first, so `HTTP_PROXY` wins over `http_proxy` when both are set, the opposite of curl and Node. There is no `ALL_PROXY` in the standard library. Two more Go rules differ from curl and requests:

- **`ProxyFromEnvironment` never proxies localhost or loopback.** The `net/http` docs return no proxy when the host is `localhost`, and the `httpproxy` docs say the same for loopback addresses, whatever `NO_PROXY` says. To send local test traffic through a proxy in Go, set `Transport.Proxy` to `http.ProxyURL(...)` yourself.
- **CGI guard.** If `REQUEST_METHOD` is set (the program runs as CGI), a request that would use `HTTP_PROXY` returns an error instead, because a client of the CGI program could set that variable.

`NO_PROXY` in Go takes IP prefixes and CIDR (`1.2.3.4/8`), domains (matching the name and all subdomains), a leading dot (subdomains only), `*`, and an optional port (`1.2.3.4:80`). This program prints the proxy Go would pick for a URL, then makes the request:

```go
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
	"os"
	"time"
)

func main() {
	target := "https://api.ipify.org"
	if len(os.Args) > 1 {
		target = os.Args[1]
	}

	req, err := http.NewRequest("GET", target, nil)
	if err != nil {
		log.Fatal(err)
	}

	proxyURL, err := http.ProxyFromEnvironment(req)
	if err != nil {
		log.Fatal(err)
	}
	if proxyURL == nil {
		fmt.Println("proxy: none (direct)")
	} else {
		fmt.Println("proxy:", proxyURL.Redacted())
	}

	client := &http.Client{
		Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
		Timeout:   15 * time.Second,
	}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(resp.Status, string(body))
}
```

Run it as `HTTPS_PROXY=http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT NO_PROXY=.internal.example.com go run main.go`. More on transports and per-request proxies on the [Go proxy](https://www.cleanproxies.com/integrations/go) page.

## NO_PROXY syntax by tool

Built from the runs above and each tool's docs read on 26 Nov 2026. "Run" means we saw it in the output above; "docs" means the tool's documentation says so.

| Entry | curl | Python requests | Node 24 built-in | Go net/http |
| --- | --- | --- | --- | --- |
| `example.com` | name + subdomains (run) | name + subdomains (run) | exact host (core docs) | name + subdomains (docs) |
| `.example.com` | subdomains; same as above in our run (run) | name + subdomains (run) | subdomains (docs) | subdomains only (docs) |
| `*` | everything (run) | everything (run) | everything (docs) | everything (docs) |
| `*.example.com` | not a pattern (docs) | matched nothing (run) | supported (docs) | not documented |
| `host:port` | no match on 7.68.0 (run) | matched that port only (run) | matched that port only (run) | supported (docs) |
| CIDR `10.0.0.0/8` | 7.86.0+, literal IPs (docs); not on 7.68.0 (run) | literal IPs only (run) | IP range form instead (docs) | supported (docs) |
| Upper vs lower case | lowercase wins (run) | both read | lowercase wins (docs) | uppercase checked first (source) |
| localhost proxied by default | yes (run) | yes (run) | yes, when opted in (run) | never via `ProxyFromEnvironment` (docs) |

Safe default for mixed stacks: `NO_PROXY=localhost,127.0.0.1,::1,internal.example.com,.internal.example.com` (bare names and exact IPs, no ports, no `*.` patterns, CIDR only if every tool and version supports it). The [PAC file](https://www.cleanproxies.com/glossary/pac-file) is the browser-side way to do the same thing with rules per URL.

## The lab script (run it yourself)

Save as `lab.py`, start it with `python3 lab.py`, and run any block above in a second terminal. Port 8888 is a fake proxy that answers plain-HTTP proxy requests itself and tunnels `CONNECT`; port 9000 is the origin.

```python
# lab.py: a fake proxy on 127.0.0.1:8888 and a test origin on 127.0.0.1:9000
import http.server
import select
import socket
import socketserver
import threading


class Proxy(http.server.BaseHTTPRequestHandler):
    def do_GET(self):  # plain-HTTP proxying: the client sends the full URL
        body = f"via PROXY  (request line: GET {self.path})\n".encode()
        self.send_response(200)
        self.send_header("Content-Length", str(len(body)))
        self.end_headers()
        self.wfile.write(body)

    def do_CONNECT(self):  # tunnel: log it, then pipe bytes both ways
        print(f"proxy log: CONNECT {self.path}", flush=True)
        host, port = self.path.rsplit(":", 1)
        upstream = socket.create_connection((host, int(port)))
        self.send_response(200, "Connection established")
        self.end_headers()
        client = self.connection
        while True:
            ready, _, _ = select.select([client, upstream], [], [], 5)
            if not ready:
                break
            for sock in ready:
                data = sock.recv(65536)
                if not data:
                    upstream.close()
                    return
                (upstream if sock is client else client).sendall(data)

    def log_message(self, *args):
        pass


class Origin(http.server.BaseHTTPRequestHandler):
    def do_GET(self):  # answered by the origin itself
        body = f"DIRECT     (Host: {self.headers.get('Host')})\n".encode()
        self.send_response(200)
        self.send_header("Content-Length", str(len(body)))
        self.end_headers()
        self.wfile.write(body)

    def log_message(self, *args):
        pass


class Server(socketserver.ThreadingMixIn, http.server.HTTPServer):
    daemon_threads = True


for port, handler in [(8888, Proxy), (9000, Origin)]:
    server = Server(("127.0.0.1", port), handler)
    threading.Thread(target=server.serve_forever, daemon=True).start()
print("lab up", flush=True)
threading.Event().wait()
```

It binds to 127.0.0.1 only and never forwards plain-HTTP requests anywhere, so it is safe to leave running while you test.

## Check the real exit IP

Once the bypass list is right, confirm what the outside world sees:

```bash
curl -s --noproxy '' -x "http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT" https://api.ipify.org; echo   # through the proxy
curl -s --noproxy '*' https://api.ipify.org; echo                                                    # direct
```

The two IPs should differ. You can also paste the proxy into the [proxy checker](https://www.cleanproxies.com/tools/proxy-checker). With static [ISP proxies](https://www.cleanproxies.com/products/isp-proxies) the exit IP stays the same on every call, which makes "did this request go through the proxy?" a one-line check.

Plans and volume prices for every product are on [/pricing](https://www.cleanproxies.com/pricing).

## FAQs

### Why does curl ignore HTTP_PROXY?

curl reads the proxy for http:// URLs only from lowercase http_proxy; the man page calls it the exception to the either-case rule. Uppercase HTTPS_PROXY, ALL_PROXY and NO_PROXY do work. In our run, HTTP_PROXY alone sent the request direct and http_proxy sent it through the proxy.

### How do I make curl skip the proxy for one command?

Use curl --noproxy '\*' URL or curl -x '' URL. Both sent the request direct in our run while http_proxy was set. To skip it only for some hosts, list them: --noproxy "localhost,.internal.example.com".

### Does NO_PROXY override -x in curl?

Yes. The man page says NO_PROXY disables the proxy "even when specified with the --proxy option", and our run confirmed it. To force the proxy anyway, add --noproxy '', which overrides the variable.

### Can NO_PROXY use wildcards or CIDR ranges?

In curl the only wildcard is a lone \*; use .example.com for subdomains. CIDR (192.168.0.0/16) needs curl 7.86.0 or newer and matches IP addresses written in the URL, not names that resolve into the range. Python requests matches CIDR against IP hosts only and ignores \*.example.com, Node's docs list ranges like 192.168.1.1-192.168.1.100, and Go accepts CIDR.

### Why does my request still go through the proxy when NO_PROXY is set?

The usual causes: the URL uses a name but NO_PROXY lists its IP (or the other way round), the entry has a port your tool does not match, both no_proxy and NO_PROXY are set and the lowercase one wins, or (in Python) the proxy was passed in code with proxies=, which NO_PROXY did not override in our runs. Run curl -v and read the "Uses proxy env variable" line.

### Which proxy works with these variables?

Any HTTP proxy written as http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT (an HTTPS proxy uses https://), and SOCKS5 through ALL_PROXY=socks5h://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT in curl and requests. CleanProxies ISP proxies support HTTP(S) with user:pass or IP whitelisting and SOCKS5; rotating residential proxies use HTTP(S) user:pass.
