Proxy Setup for Python, Node.js and Docker

NO_PROXY, HTTP_PROXY and HTTPS_PROXY Explained

Diagnose ignored proxy variables and unexpected bypasses in curl, HTTPX, aiohttp and Node fetch. Compare documented settings with local routing observations.

By Proxies.sx Team. Reviewed .

Proxy environment variables are client configuration. Each application decides whether to read them and how to match NO_PROXY. Check the actual client and running process before copying one environment file across a stack.

In this guide

Start with the client that sends the request

A terminal, container and browser can run with different settings. We tested four clients against a local HTTP target and an authenticated local proxy. The table records whether that fixture observed the request. It is not a speed or anonymity comparison.

Client and settingObserved pathExact NO_PROXY IP match
HTTPX 0.28.1, environment defaultsProxyDirect
aiohttp 3.14.5, default sessionDirectEnvironment routing not enabled
aiohttp 3.14.5, trust_env=TrueProxyDirect
Node 24.16 fetch, no opt-inDirectEnvironment routing not enabled
Node 24.16 fetch, --use-env-proxyProxy tunnelDirect
curl, lowercase http_proxyProxyDirect
curl, only uppercase HTTP_PROXY, HTTP targetDirectProxy variable ignored

The test record includes the curl and Python versions. We cleared inherited proxy variables for each case and used an exact IP match; the experiment does not establish wildcard, suffix or CIDR behavior for every client.

Read destination schemes and proxy schemes separately

HTTP_PROXY and HTTPS_PROXY usually select the proxy for HTTP and HTTPS destinations. The URL stored in a variable identifies the proxy listener. An HTTPS destination can therefore use an http:// proxy that supports CONNECT.

ALL_PROXY is supported by clients such as curl and HTTPX. Do not assume it is a universal fallback: the documented Node environment interface on this page lists HTTP, HTTPS and bypass settings. NO_PROXY names destinations that should bypass environment proxy routing when the client supports that behavior.

curl deliberately accepts http_proxy in lowercase only. Its other proxy variable names can also be uppercase. This specific exception is documented in everything curl; it is not a general rule that all uppercase proxy variables fail.

Make bypass entries deliberate

For internal services, start with the actual destination host names used by the application. If it calls http://api:8080, a bypass entry for a different host name does not describe that request. Use host entries rather than copying an entire request URL into every client's bypass list.

Check the client's documented matching rules before using leading dots, wildcard patterns, ports or CIDR ranges. Docker's proxy guide explicitly notes the lack of a shared standard for these variables. A copied NO_PROXY=* can disable proxy use entirely in clients that support that wildcard.

A short explicit list is easier to test than a broad rule. Verify one expected internal bypass and one external proxied request from the same worker. Retest the list when the HTTP library changes.

# Example destinations to bypass, when supported by the client:
NO_PROXY=localhost,127.0.0.1,api
# This is a destination list, not a list of proxy hosts.

Find why the running process ignores a change

  1. Identify the actual HTTP client and version. A framework can use several clients for different operations.
  2. Inspect variable presence inside the running worker without dumping credential values into logs.
  3. Look for lowercase and uppercase duplicates, explicit proxy parameters, custom transports and bypass entries.
  4. Restart or recreate the relevant process after changing its environment.
  5. Observe a request at a proxy you control, or compare provider-side request evidence. A 200 response by itself cannot identify the route.

This Python check reports names and presence only. It does not validate URLs or prove which value the client uses.

import os
names = (
    "http_proxy", "HTTP_PROXY", "https_proxy", "HTTPS_PROXY",
    "all_proxy", "ALL_PROXY", "no_proxy", "NO_PROXY",
)
for name in names:
    print(name, "set" if os.environ.get(name) else "empty or absent")

Choose explicit configuration when the route must be clear

For one client, an explicit proxy can make a small diagnostic easier to reproduce. The HTTPX example and aiohttp example disable environment discovery and supply proxy settings directly. The examples construct their TLS context explicitly; supply an approved CA bundle if your deployment needs one.

For a process-wide Node policy, use the Node fetch setup. For containers, first separate the application environment from image pulls and build steps using the Docker guide.

Common questions

Does setting HTTPS_PROXY encrypt the connection to the proxy?

The proxy URL scheme chooses that transport. HTTPS_PROXY identifies a destination scheme; a value beginning with http:// still selects an HTTP proxy listener.

Why did adding NO_PROXY make the proxy disappear?

A matching bypass rule can make an environment-aware client contact the target directly. Check the exact rule and client behavior, then repeat the request from the same process.

Sources and test scope

Official documentation checked on 14 October 2026. The linked local test records identify the tested versions and limits. The examples do not establish public proxy availability or destination acceptance.

Machine-readable guide index and local routing test results.

Connect your application to Proxies.sx

Use the username builder for gateway routing fields and the format converter for existing connection lists. Review Pool Gateway documentation, then check current mobile stock before buying traffic.

For agent-driven workflows, the agent service index lists the supported APIs. A configured HTTP client still needs to validate its task's response.

Configure the client that sends your requests

Start with the proxy configuration guide, or open the setup for your runtime.