HTTP_PROXY, HTTPS_PROXY and NO_PROXY: Practical Configuration Guide

Compare real proxy environment behavior across HTTPX, Requests, aiohttp, Windows curl and Linux curl, with scoped setup and bypass checks.

Written by the Mexela Editorial Team. Technical guides are reviewed by the Mexela Technical Team under the Mexela Editorial Policy.

PROXY OPTIONS

Choose a route for this environment

Once the application path and proxy bypass rules are verified, compare plans for the protocol and authentication your environment supports. Recheck the same client after changing its endpoint.

HTTP_PROXY, HTTPS_PROXY and NO_PROXY are conventions interpreted by individual clients. Set them in a narrow process scope, check the client’s case and inheritance rules, and verify both a proxied destination and an intended bypass. An environment value alone does not prove routing.

Reviewed and locally tested: October 12, 2026. Version and route observations below describe the stated test environment. A working local route does not establish a provider’s public exit, country, anonymity, speed, or uptime.

Match the variable to the destination request

Variable Purpose to check in your client
http_proxy / HTTP_PROXY Proxy used for an HTTP destination
https_proxy / HTTPS_PROXY Proxy used for an HTTPS destination
NO_PROXY / no_proxy Destinations that should bypass the configured proxy
ALL_PROXY / all_proxy Fallback supported by some clients; inspect it when diagnosing stale settings

An HTTPS destination can use an HTTP proxy endpoint: the destination selects the variable, while the URL scheme describes the proxy transport. Bypass syntax is also client-specific. Exact hostnames, suffixes, ports and CIDR ranges are not interchangeable promises across all libraries. Start with one exact test target.

Use a temporary shell scope

http_proxy="$PROXY_URL" https_proxy="$PROXY_URL" \
NO_PROXY="localhost,127.0.0.1" \
curl --silent --show-error --fail --max-time 8 "$CHECK_URL"

Here PROXY_URL and CHECK_URL are supplied securely before the command. The assignments apply to that command rather than permanently changing a login profile. Use an owned or trusted check endpoint. A localhost destination will deliberately bypass this example proxy; choose a non-bypassed endpoint when proving a public route.

$env:http_proxy = $env:PROXY_URL
$env:https_proxy = $env:PROXY_URL
$env:NO_PROXY = "localhost,127.0.0.1"
curl.exe --silent --show-error --fail --max-time 8 $env:CHECK_URL

The PowerShell values affect that process and its subsequently launched children. Record and restore any pre-existing values afterward; deleting a value is not restoration if another tool had already set it. Use curl.exe explicitly so an alias does not change the client being tested. Do not use an environment dump as a diagnostic report because it can disclose credentials.

Measured client differences on Windows

We ran 25 requests: five configurations across five clients, against an owned HTTP loopback destination and authenticated forward proxy. Python was 3.12.14. The matrix used HTTPX 0.28.1, Requests 2.34.2, aiohttp 3.14.5 and curl 8.21.0. Windows environment variable names are case-insensitive, which changes the meaning of an uppercase/lowercase comparison.

On narrow screens, scroll this table horizontally to see every configuration.

Client No proxy variable HTTP_PROXY http_proxy Matching NO_PROXY Nonmatching NO_PROXY
HTTPX, environment enabled Direct Proxy Proxy Direct Proxy
Requests, default environment path Direct Proxy Proxy Direct Proxy
aiohttp default session Direct Direct Direct Direct Direct
aiohttp trust_env=True Direct Proxy Proxy Direct Proxy
Windows curl 8.21.0 Direct Proxy Proxy Direct Proxy

The matching bypass was the exact IPv4 loopback host. These results do not establish arbitrary domain patterns, wildcard portability, HTTPS environment routing, or CIDR behavior for every client. Destination observations identified the actual local socket route and confirmed that proxy authentication was not forwarded downstream.

Linux curl treats HTTP_PROXY differently

Inside Ubuntu 24.04 under WSL2, curl 8.5.0 used the proxy for lowercase http_proxy, but stayed direct with uppercase HTTP_PROXY alone. Matching NO_PROXY also stayed direct. Forcing an empty bypass with --noproxy "" used the proxy again. This is an actual Linux observation, not a conclusion extrapolated from Windows.

The curl environment reference explains the special treatment of uppercase HTTP_PROXY. Do not generalize that rule to every variable or to the Windows environment. See the WSL2 guide when a command changes behavior across shells.

Identify the process that owns the setting

Write down the executable, version, parent shell and configuration layer before comparing results. A container, CI job, editor extension or child process can receive a different environment. A client with explicit proxy configuration may follow a different path from a library using environment inheritance. Keep your diagnostic request in the exact process that performs the production request.

For Python, compare explicit HTTPX configuration and aiohttp environment trust. Their primary references are HTTPX environment variables, Requests proxies and aiohttp proxy support. For other scopes, use Docker configuration, Go transports and Git and npm; those clients were not part of this measured matrix.

Frequently asked questions

Should NO_PROXY contain * to make troubleshooting easier?

A broad bypass can defeat the route you intended to test. Use one deliberate target first, verify direct versus proxied behavior, then extend the rule according to that client’s documented grammar.

Why does a setting work in Windows but fail in WSL?

Linux processes have a separate environment and can interpret case differently. Check the variable inside the WSL process and verify the Linux client, rather than assuming Windows shell values were inherited.

Verify one client before increasing workload

Return to Proxy Setup and Developer Guides for adjacent clients. Use the proxy verification checklist to record a direct baseline and the destination’s observation. When that is repeatable, compare Mexela proxy locations against the actual destination and location requirements.

Download the developer examples

Download the developer examples ZIP for the locally tested Python clients, environment checks, CI route-check files and native PHP cURL helper. The n8n workflow is a separate illustrative reference: it was not imported or executed in n8n. Read the included README for runtime versions, setup and the limits of each check.

ZIP SHA-256: 3a43f7d1e6cbb9b2917dbcf88aaa8fe1a2733c33326187cb89c9a9119aad3e20. Keep real proxy credentials and destination secrets in your approved secret store; they are absent from this archive. Start with one approved destination and compare its observation with a direct baseline.