Jump to solution
Verify

The Fix

Upgrade to version 0.13.0 or later.

Based on closed encode/httpx issue #779 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Jump to Verify Open PR/Commit
@@ -176,7 +176,7 @@ client = httpx.Client(trust_env=False) ## HTTP Proxying -HTTPX supports setting up proxies the same way that Requests does via the `proxies` parameter. +HTTPX supports setting up HTTP proxies the same way that Requests does via the `proxies` parameter. For example to forward all HTTP traffic to `http://127.0.0.1:3080` and all HTTPS traffic
repro.py
proxy = { 'http' : 'http://user:[email protected]:YY', 'https' : 'http://user:[email protected]:YY' } def run_sync(url): with httpx.Client(verify=False, proxies=proxy) as client: response = client.get(url) print(response)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\nUpgrade to version 0.13.0 or later.\nWhen NOT to use: Do not use this fix if your proxy does not require authentication.\n\n

Why This Fix Works in Production

  • Trigger: When using httpx.Client with proxies, authentication fails
  • Mechanism: HTTPX was not creating a Proxy-Authorization header for proxy URLs with credentials
  • Why the fix works: Detects credentials in proxy URLs and creates a Proxy-Authorization header, fixing authentication issues when using proxies with httpx.Client. (first fixed release: 0.13.0).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • HTTPX was not creating a Proxy-Authorization header for proxy URLs with credentials
  • Production symptom (often without a traceback): When using httpx.Client with proxies, authentication fails

Proof / Evidence

  • GitHub issue: #779
  • Fix PR: https://github.com/encode/httpx/pull/780
  • First fixed release: 0.13.0
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.57

Verified Execution

We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.

  • Status: PASS
  • Ran: 2026-02-11T16:52:29Z
  • Package: httpx
  • Fixed: 0.13.0
  • Mode: fixed_only
  • Outcome: ok
Logs
affected (exit=None)
fixed (exit=0)

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“When doing something like this For a private proxy that includes authentication, the request will fail with a "Proxy Authentication Required" error. I think httpx is doing something like this: instead of this”
Issue thread · issue description · source

Failure Signature (Search String)

  • When using httpx.Client with proxies, authentication fails
  • For a private proxy that includes authentication, the request will fail with a "Proxy Authentication Required" error. I think httpx is doing something like this:
Copy-friendly signature
signature.txt
Failure Signature ----------------- When using httpx.Client with proxies, authentication fails For a private proxy that includes authentication, the request will fail with a "Proxy Authentication Required" error. I think httpx is doing something like this:

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- When using httpx.Client with proxies, authentication fails For a private proxy that includes authentication, the request will fail with a "Proxy Authentication Required" error. I think httpx is doing something like this:

Minimal Reproduction

repro.py
proxy = { 'http' : 'http://user:[email protected]:YY', 'https' : 'http://user:[email protected]:YY' } def run_sync(url): with httpx.Client(verify=False, proxies=proxy) as client: response = client.get(url) print(response)

What Broke

Requests to proxied URLs fail with a 407 Proxy Authentication Required error.

Why It Broke

HTTPX was not creating a Proxy-Authorization header for proxy URLs with credentials

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

Upgrade to version 0.13.0 or later.

When NOT to use: Do not use this fix if your proxy does not require authentication.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/encode/httpx/pull/780

First fixed release: 0.13.0

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if your proxy does not require authentication.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.

Version Compatibility Table

VersionStatus
0.13.0 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.