Jump to solution
Verify

The Fix

pip install urllib3==1.25

Based on closed urllib3/urllib3 issue #1032 · 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
@@ -275,6 +275,11 @@ def test_contextmanager(self): self.assertRaises(Empty, old_pool_queue.get, block=False) + def test_mixed_case_url(self): + pool = HTTPConnectionPool('Example.com') + response = pool.request('GET', "http://Example.com")
repro.py
Traceback (most recent call last): File "minimum.py", line 5, in <module> response = pool.request('GET', "http://Example.com") File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 66, in request **urlopen_kw) File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 87, in request_encode_url return self.urlopen(method, url, **extra_kw) File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 549, in urlopen raise HostChangedError(self, url, retries) urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='Example.com', port=None): Tried to open a foreign host with url: http://Example.com
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\npip install urllib3==1.25\nWhen NOT to use: This fix should not be used if the application relies on case-sensitive hostnames.\n\n

Why This Fix Works in Production

  • Trigger: response = pool.request('GET', "http://Example.com")
  • Mechanism: HostChangedError occurs due to the hostname not being downcased in the ConnectionPool
  • Why the fix works: Fixes the HostChangedError by applying lowercasing to all hosts given to the ConnectionPool. (first fixed release: 1.25).
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

  • Shows up under Python 3.5 in real deployments (not just unit tests).
  • HostChangedError occurs due to the hostname not being downcased in the ConnectionPool
  • Surfaces as: Traceback (most recent call last):

Proof / Evidence

  • GitHub issue: #1032
  • Fix PR: https://github.com/urllib3/urllib3/pull/1033
  • First fixed release: 1.25
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.43

Discussion

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

“Hmmm”
@haikuginger · 2016-11-09 · source
“I'm not sure why I was using ConnectionPool, I will use PoolManager instead”
@NickMolloy · 2016-11-09 · source
“So the biggest issue here is probably that we should forcibly lowercase the hostname in the base ConnectionPool class. I'd accept a patch that does…”
@Lukasa · 2016-11-09 · source
“@Lukasa Is a blind lower() call appropriate? I thought that function was too smart for it's own good with some non-ASCII characters.”
@sethmlarson · 2016-11-09 · source

Failure Signature (Search String)

  • response = pool.request('GET', "http://Example.com")

Error Message

Stack trace
error.txt
Error Message ------------- Traceback (most recent call last): File "minimum.py", line 5, in <module> response = pool.request('GET', "http://Example.com") File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 66, in request **urlopen_kw) File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 87, in request_encode_url return self.urlopen(method, url, **extra_kw) File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 549, in urlopen raise HostChangedError(self, url, retries) urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='Example.com', port=None): Tried to open a foreign host with url: http://Example.com

Minimal Reproduction

repro.py
Traceback (most recent call last): File "minimum.py", line 5, in <module> response = pool.request('GET', "http://Example.com") File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 66, in request **urlopen_kw) File "/usr/local/lib/python3.5/dist-packages/urllib3/request.py", line 87, in request_encode_url return self.urlopen(method, url, **extra_kw) File "/usr/local/lib/python3.5/dist-packages/urllib3/connectionpool.py", line 549, in urlopen raise HostChangedError(self, url, retries) urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='Example.com', port=None): Tried to open a foreign host with url: http://Example.com

Environment

  • Python: 3.5

What Broke

Requests to a pool with uppercase hostnames result in HostChangedError exceptions.

Why It Broke

HostChangedError occurs due to the hostname not being downcased in the ConnectionPool

Fix Options (Details)

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

pip install urllib3==1.25

When NOT to use: This fix should not be used if the application relies on case-sensitive hostnames.

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

Fix reference: https://github.com/urllib3/urllib3/pull/1033

First fixed release: 1.25

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

  • This fix should not be used if the application relies on case-sensitive hostnames.

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.
  • Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
  • Add a long-running test that repeats the failing call path and asserts stable memory.

Version Compatibility Table

VersionStatus
1.25 Fixed

Related Issues

No related fixes found.

Sources

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