From e87b0fd9ec3503ac41efd895e79e7d078589a7d0 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Mon, 23 Feb 2026 14:18:54 +0100 Subject: [PATCH] docs: ip ranges in no_proxy --- docs/environment_variables.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/environment_variables.md b/docs/environment_variables.md index 0364deb0..7ff15430 100644 --- a/docs/environment_variables.md +++ b/docs/environment_variables.md @@ -36,19 +36,20 @@ python -c "import httpx; httpx.get('http://example.com', trust_env=False)" ### `NO_PROXY` -Valid values: a comma-separated list of hostnames/urls +Valid values: a comma-separated list of hostnames/urls/ip ranges `NO_PROXY` disables the proxy for specific urls ```bash export HTTP_PROXY=http://my-external-proxy.com:1234 -export NO_PROXY=http://127.0.0.1,python-httpx.org +export NO_PROXY=http://127.0.0.0/8,python-httpx.org,::1 # As in the previous example, this request will be sent through the proxy python -c "import httpx; httpx.get('http://example.com')" # These requests will be sent directly, bypassing the proxy -python -c "import httpx; httpx.get('http://127.0.0.1:5000/my-api')" +python -c "import httpx; httpx.get('http://127.0.0.10:5000/my-api')" +python -c "import httpx; httpx.get('http://[::1]:5000/my-api')" python -c "import httpx; httpx.get('https://www.python-httpx.org')" ```