On this page
There is no NO_PROXY standard
The proxy variables date back to libwww in the 1990s. No RFC defines them. Each HTTP library reads them as its authors saw fit, and the results drift apart in small ways. GitLab hit this in production and wrote it up in We need to talk: Can we standardize NO_PROXY?. Their summary is blunt. HTTP is a well-defined standard, but no standard exists for how clients handle these variables.
The variables themselves are simple. HTTP_PROXY names the proxy for http:// URLs. HTTPS_PROXY names the proxy for https:// URLs. NO_PROXY lists hosts that skip the proxy. Some clients also read ALL_PROXY. Each one has a lowercase twin, and the twins are where the trouble starts.
This matters most when you want selective proxying. A typical case is an app on a serverless platform whose egress IP changes (see why serverless egress IPs change). One partner API only accepts a fixed IP, so its calls must go through a static IP proxy. Everything else, such as your database, logging, and telemetry, should go direct. With the environment variables, a single NO_PROXY entry decides which side every call lands on. If two libraries in your process read that entry differently, one of them sends traffic the wrong way.
How we tested six clients
GitLab's post first ran in 2021 and some clients have changed since. So we ran our own matrix in November 2026. We started a fake proxy that logs the first line of each connection and answers 403. Then we pointed each client at it through the environment and asked for a set of URLs. If the proxy logged a CONNECT, the client used the proxy. If not, it went direct.
- curl 8.21.0.
- Python requests 2.33.1 and 2.34.2, on Python 3.13.
- Python httpx 0.28.1, the latest release.
- Go 1.26.4
net/httpwith the default transport. We checked that the release-branch.go1.27 source has the same proxy code. - Node.js 26.5 global
fetchand thehttpsmodule, both withNODE_USE_ENV_PROXY=1.
The method works for any client you want to check. Start a listener, set the variables, and see whether it gets a connection.
# Terminal 1: a listener that prints whatever arrives
nc -l 127.0.0.1 18082
# Terminal 2: does curl send this URL to the proxy?
HTTPS_PROXY=http://127.0.0.1:18082 NO_PROXY=example.com \
curl -s -m 2 -o /dev/null https://api.example.com/
# Nothing printed in terminal 1: curl skipped the proxy.Which variable wins
Most clients prefer the lowercase variable when both cases are set. Go is the exception in every released version. The table shows what each client did when https_proxy and HTTPS_PROXY pointed at two different proxies, and when only some variables were set.
| Client | Reads uppercase HTTP_PROXY | Wins when both cases are set | https:// falls back to HTTP_PROXY | Reads ALL_PROXY |
|---|---|---|---|---|
| curl 8.21 | No | Lowercase | No | Yes |
| requests 2.34 | Yes | Lowercase | No | Yes |
| httpx 0.28 | Yes | Lowercase | No | Yes |
| Go 1.26 and 1.27 | Yes | Uppercase | No | No |
| Node.js fetch | Yes | Lowercase | Yes | No |
| Node.js http and https | Yes | Lowercase | No | No |
Why curl ignores uppercase HTTP_PROXY
In a CGI program, a request header named Proxy arrives as the environment variable HTTP_PROXY. An attacker can set it. This class of bug was disclosed in 2016 as httpoxy. curl's documentation says http_proxy is only accepted in lowercase for this reason. Uppercase HTTPS_PROXY still works in curl. Go takes a different route. Its httpproxy package refuses to use HTTP_PROXY when REQUEST_METHOD is set, which marks a CGI process.
Go is changing its precedence
Go 1.26 and 1.27 read HTTPS_PROXY before https_proxy, and NO_PROXY before no_proxy. In July 2026 the Go team merged a change to golang.org/x/net that prefers lowercase, to match what most other tools do. The tracking issue is golang/go#79656. Go's master branch already vendors the new code. The released 1.27 branch does not. So the same environment can route differently after a Go upgrade, but only if you set both cases to different values.
Node's fetch has a fallback the others lack
With only HTTP_PROXY set, Node's fetch sent an https:// request through it. Every other client went direct. This is documented behaviour of undici's EnvHttpProxyAgent, which says that if only http_proxy is set, it is used for both HTTP and HTTPS requests. If you set HTTP_PROXY for some unrelated tool, Node's fetch starts proxying your HTTPS calls too.
How each client matches NO_PROXY entries
This is where the clients disagree most. Each row sets HTTPS_PROXY and one NO_PROXY value, then requests one URL. Bypass means the request went direct. Proxied means it went through the proxy.
| NO_PROXY / URL host | curl | requests | httpx | Go | Node fetch | Node https |
|---|---|---|---|---|---|---|
example.com / api.example.com | Bypass | Bypass | Bypass | Bypass | Bypass | Proxied |
example.com / notexample.com | Proxied | Proxied | Proxied | Proxied | Proxied | Proxied |
.example.com / example.com | Bypass | Bypass | Proxied | Proxied | Bypass | Bypass |
.example.com / api.example.com | Bypass | Bypass | Bypass | Bypass | Bypass | Bypass |
*.example.com / api.example.com | Proxied | Proxied | Proxied | Bypass | Bypass | Bypass |
10.0.0.0/8 / 10.1.2.3 | Bypass | Bypass | Proxied | Bypass | Proxied | Proxied |
example.com:8443 / api.example.com:8443 | Proxied | Bypass | Bypass | Bypass | Bypass | Proxied |
* / api.example.com | Bypass | Bypass | Bypass | Bypass | Bypass | Bypass |
(unset) / localhost | Proxied | Proxied | Proxied | Bypass | Proxied | Proxied |
Only three rows agree across all six clients. A bare * disables the proxy everywhere, .example.com always covers subdomains, and example.com no longer matches notexample.com on current versions. Every other form behaves differently in at least one client.
- A bare domain covers subdomains in most clients. Node's built-in
httpandhttpsagent treatsexample.comas an exact host. Its documentation listsexample.comas an exact match and.example.comas the suffix form. - A leading dot matches the apex domain in curl, requests, and Node. In Go and httpx,
.example.commatches subdomains only. The Go docs state this outright. - The
*.wildcard is not a wildcard in curl. The libcurl docs say the only wildcard is a single*. requests and httpx do not treat it as one either. - CIDR works in curl (since 7.86.0), requests, and Go. httpx and Node ignored
10.0.0.0/8. Node's http module accepts IP ranges in the form192.168.1.1-192.168.1.100instead. - CIDR only ever matches when the URL itself contains an IP address. None of these clients resolve a host name to check it against a range. GitLab found that only Ruby does.
- A port in an entry is ignored by curl. curl compares host names only, so
example.com:8443matched nothing.
Surprises that send traffic the wrong way
The matrix shows parsing. These are the behaviours that cause incidents, each one reproduced in our tests.
requests before 2.34 matched too much
With NO_PROXY=example.com, requests 2.33.1 sent https://notexample.com direct. It used a plain string suffix check, so any host ending in those characters matched. The 2.34.0 release notes say requests no longer performs greedy matching on no_proxy domains. Version 2.34.0 shipped in May 2026. Many lock files still pin older versions, so check yours.
One Node process, two matchers
NODE_USE_ENV_PROXY=1 turns on proxy support for both fetch and the http and https modules. They do not share a matcher. With NO_PROXY=example.com, fetch sent api.example.com direct while https.get sent the same URL through the proxy. An SDK built on https and your own fetch calls can therefore split, in the same process, on the same variable. The Node docs mark the feature as active development.
Go never proxies localhost and reads the environment once
Go's http.ProxyFromEnvironment returns no proxy for localhost and loopback addresses, whatever you set. Go also caches the environment. The default transport reads the variables once per process through a sync.Once in net/http's transport.go. Calling os.Setenv after the first request changes nothing. undici behaves differently. Its EnvHttpProxyAgent re-reads no_proxy on demand, but reads the proxy URLs only once, when the agent is created.
curl applies NO_PROXY even to an explicit proxy
Passing --proxy on the command line does not override the environment's NO_PROXY. We ran curl --proxy with NO_PROXY=example.com and https://api.example.com went direct. libcurl uses the no_proxy variable whenever its own CURLOPT_NOPROXY option is unset. Add --noproxy '' to force the proxy.
requests lets the environment override a session
Setting session.proxies is not enough when HTTPS_PROXY is also set. The requests docs warn that environment proxies overwrite session values, and point to issue #2018. In our test, the session's proxy lost to the environment's. Proxies passed on each request, or a session with trust_env = False, kept the right one.
An empty lowercase variable can hide the uppercase one
With no_proxy set to an empty string and NO_PROXY=example.com, httpx and both Node paths proxied api.example.com. curl, requests, and Go skipped the empty value and used the uppercase one. Container images and CI systems sometimes export empty variables, so this one is easy to hit without noticing.
Per-client proxy config is the safer pattern
All of these problems share a cause. A global variable is read by every library in the process, each with its own rules. You cannot test every combination, and a dependency upgrade can change the answer. The fix is to stop asking the environment.
- Store the proxy URL in a variable no library reads, such as
PARTNER_PROXY_URLorFIXEDMARK_PROXY_URL. Do not setHTTPS_PROXYin the app's environment. - Build one client for the allowlisted API with that proxy passed in code. Reuse it.
- Build the default client so it ignores the proxy variables, so a stray
HTTPS_PROXYfrom the platform or a base image cannot pull it through the proxy. - Verify the egress IP from the proxied client and from the direct one before you ship.
Explicit settings beat the environment in these clients, with the two exceptions above. curl still applies NO_PROXY, and requests lets the environment override session.proxies. httpx ignores the proxy variables entirely when you pass proxy=. Go's http.ProxyURL and undici's ProxyAgent never look at the environment.
// npm install undici
import { Agent, fetch, ProxyAgent } from "undici";
// One agent per route, created once and reused.
const viaProxy = new ProxyAgent(process.env.FIXEDMARK_PROXY_URL);
const direct = new Agent(); // ignores HTTPS_PROXY and NO_PROXY
// The allowlisted partner call leaves from the static IP.
const orders = await fetch("https://api.partner.example/v1/orders", {
dispatcher: viaProxy,
});
// Everything else goes direct, whatever the environment says.
const health = await fetch("https://api.internal.example/health", {
dispatcher: direct,
});import os
import requests
partner = requests.Session()
# Ignore HTTPS_PROXY and NO_PROXY so session.proxies is never overridden.
# This also turns off REQUESTS_CA_BUNDLE and .netrc for this session.
partner.trust_env = False
partner.proxies = {"https": os.environ["FIXEDMARK_PROXY_URL"]}
res = partner.get("https://api.partner.example/v1/orders", timeout=15)# pip install "httpx>=0.28"
import os
import httpx
# proxy= replaces every proxy variable for this client, NO_PROXY included.
partner = httpx.Client(proxy=os.environ["FIXEDMARK_PROXY_URL"], timeout=15)
# trust_env=False makes the default client ignore the proxy variables.
direct = httpx.Client(trust_env=False, timeout=15)
res = partner.get("https://api.partner.example/v1/orders")package main
import (
"log"
"net/http"
"net/url"
"os"
"time"
)
func newClient(proxy func(*http.Request) (*url.URL, error)) *http.Client {
t := http.DefaultTransport.(*http.Transport).Clone()
t.Proxy = proxy // nil means always direct
return &http.Client{Transport: t, Timeout: 15 * time.Second}
}
func main() {
proxyURL, err := url.Parse(os.Getenv("FIXEDMARK_PROXY_URL"))
if err != nil {
log.Fatal(err)
}
partner := newClient(http.ProxyURL(proxyURL))
direct := newClient(nil)
res, err := partner.Get("https://api.partner.example/v1/orders")
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
_ = direct
}# Force the proxy, even if NO_PROXY in the environment matches.
curl --noproxy '' --proxy "$FIXEDMARK_PROXY_URL" \
https://api.partner.example/v1/orders
# Force a direct connection, even if HTTPS_PROXY is set.
curl --noproxy '*' https://api.internal.example/healthWe ran each snippet against the fake proxy with HTTPS_PROXY and NO_PROXY also set to conflicting values. The proxied clients reached the proxy and the direct clients did not. For the Next.js version of this pattern, with route handlers and server actions, see routing only some fetches through a proxy in Next.js.
If you must use the environment variables
Sometimes you cannot change the code. A CLI tool, a vendored SDK, or a build step may only read the environment. Then write values that every client in the matrix reads the same way.
- Set the lowercase and uppercase names to the same value. This removes the Go precedence difference and the empty-variable trap.
- To cover a domain and all its subdomains, list both forms, as in
example.com,.example.com. That pair bypassed apex and subdomains in all six clients. - Do not use
*.example.com. curl, requests, and httpx do not treat it as a wildcard. - Do not rely on CIDR ranges or ports. List exact IPs and host names instead.
- Do not put a broad suffix such as
.comor.inin the list. It sends a whole top-level domain direct, including the API you meant to proxy. - Set
HTTPS_PROXYexplicitly. Do not count on a fallback fromHTTP_PROXY, since only Node'sfetchdoes that.
Then ask each library what it will do, rather than reading code. requests and Go expose the decision function directly.
NO_PROXY=example.com,.example.com HTTPS_PROXY=http://proxy.internal:3128 \
python -c 'import requests.utils as u; print(u.get_environ_proxies("https://api.example.com/"))'
# {} means requests will go direct for this URL.// go run . https://api.example.com/
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", os.Args[1], nil)
if err != nil {
panic(err)
}
// The same function http.DefaultTransport uses.
proxy, err := http.ProxyFromEnvironment(req)
fmt.Println(proxy, err) // <nil> <nil> means direct
}For Node and curl, use the listener method from the testing section. Check the egress IP as the last step either way. Our egress IP check shows how, and why requests skip the proxy covers the common causes.
Doing this with Fixedmark
Fixedmark gives an app a static outbound IP pair through one proxy URL. It is in early access. The docs name that URL FIXEDMARK_PROXY_URL on purpose. No library reads that variable, so nothing gets proxied until you pass it to a client. The language guides for Node.js, Python, and Go show the per-client setup for each library, including axios and SDKs that take an agent.
Selective proxying also matters for cost. Each call through the proxy counts against your plan's bandwidth, so a global HTTPS_PROXY that catches telemetry or database APIs adds usage you did not intend. See pricing for the planned plans.
Two features help catch mistakes. Destination allowlists, on plans that include them, restrict a proxy credential to the hosts and ports you list, such as the one partner API. A call that leaks into the proxy fails instead of quietly leaving from your static IP. Connection logs show the destination, SNI, and egress IP of each connection, so you can see exactly which hosts went through.
Sources
Checked November 2026. Confirm current details on the vendor's site before you decide. Prices and limits change.
- GitLab: We need to talk: Can we standardize NO_PROXY?
- Everything curl: Proxy environment variables
- libcurl: CURLOPT_NOPROXY
- Requests: Advanced usage, Proxies
- Requests: Release history (2.34.0 no_proxy fix)
- HTTPX: Environment variables
- Go: golang.org/x/net/http/httpproxy
- Go: http/httpproxy, prioritize lowercase proxy variables
- Node.js: Built-in proxy support
- undici: EnvHttpProxyAgent
- httpoxy: CGI HTTP_PROXY vulnerability

