Skip to content

About

Show which proxy curl and Python requests will use for a URL from your environment variables and system settings, with NO_PROXY rules. Maintained by Proxy302.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

proxy-env-check: which proxy will my program actually use?

A program uses a proxy from environment variables only if it reads them, and different tools read them differently. curl ignores upper-case HTTP_PROXY for http:// URLs and only reads lower-case http_proxy. Python's requests reads both and, on macOS and Windows, falls back to the system proxy settings when no variable is set. Node.js fetch ignores all of them unless Node is started with NODE_USE_ENV_PROXY=1. proxy-env-check.py prints, for each URL you give it, what curl and Python will do in your current shell, including whether NO_PROXY sends the request direct. Passwords are masked.

Proxy302 maintains this tool and sells proxies. If you need a proxy to test with, the cheapest option is one static residential (ISP) IP for one day at $0.50 (prices). The tool itself works with any provider and does not connect anywhere.

Usage

git clone https://github.com/proxy302/proxy-env-check
cd proxy-env-check
python3 proxy-env-check.py                                  # checks https://example.com/ and http://example.com/
python3 proxy-env-check.py https://api.example.com/ http://intranet/

Python 3.8 or later, standard library only.

Example output

Run with HTTP_PROXY, https_proxy and NO_PROXY set:

Proxy variables set in this shell:
  HTTP_PROXY=http://u:****@10.0.0.1:8080
  https_proxy=http://u:****@10.0.0.2:8080
  NO_PROXY=internal.example,.corp

http://example.com/
  curl             -> DIRECT (no variable applies)
  Python requests  -> http://u:****@10.0.0.1:8080  (from environment)

https://example.com/
  curl             -> http://u:****@10.0.0.2:8080  (from https_proxy)
  Python requests  -> http://u:****@10.0.0.2:8080  (from environment)

https://api.internal.example/
  curl             -> DIRECT (host matches no_proxy)
  Python requests  -> DIRECT (host is in the bypass list)

Reading the output

  • curl DIRECT on an http:// URL while Python uses a proxy: you set HTTP_PROXY in capitals. curl only honours http_proxy for plain HTTP (upper case is ignored on purpose, for security in CGI environments). Set the lower-case one.
  • "from system proxy settings": no variable is set, but Python found a proxy in the macOS or Windows network settings. curl does not read those.
  • DIRECT because of no_proxy: entries match the host itself and its subdomains; * turns proxies off for everything.
  • Nothing set at all: the program connects directly unless it has its own proxy option.

FAQ

Does this test whether the proxy works? No. It only shows which proxy would be chosen. To test the proxy itself, run curl -x 'http://USER:PASS@HOST:PORT' https://api.ipify.org and compare with your own address.

Which variable should I set? For most tools set both https_proxy and http_proxy in lower case, plus no_proxy for internal hosts. Add all_proxy only if a tool needs SOCKS for everything.

What about Docker, git, npm and pip? They have their own settings or read these variables with their own rules. See the proxy guides for each tool.

Why does my script ignore the variables entirely? Some libraries need the proxy passed in code (for example Node's fetch without NODE_USE_ENV_PROXY, or Go programs that build a custom transport).

Facts checked 20 November 2026.

About

Show which proxy curl and Python requests will use for a URL from your environment variables and system settings, with NO_PROXY rules. Maintained by Proxy302.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages