The Fix
pip install urllib3==1.25
Based on closed urllib3/urllib3 issue #760 · 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%.
@@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIIClTCCAX2gAwIBAgIBATANBgkqhkiG9w0BAQsFADAOMQwwCgYDVQQDDAM6OjEw
+HhcNMTUxMjE1MTY0NjQxWhcNMjEwODAyMDAwMDAwWjAOMQwwCgYDVQQDDAM6OjEw
Option A — Upgrade to fixed release\npip install urllib3==1.25\nWhen NOT to use: Do not apply this fix if the hostname is not an IPv6 address.\n\n
Why This Fix Works in Production
- Trigger: Apparently, while `httplib` itself doesn't care about the square brackets, the `match_hostname` function needs them gone. I suggest we move the stripping down…
- Mechanism: The match_hostname function fails to handle IPv6 addresses with square brackets
- Why the fix works: Strips brackets from hostnames before validating, resolving issue #760. (first fixed release: 1.25).
- 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
- The match_hostname function fails to handle IPv6 addresses with square brackets
- Production symptom (often without a traceback): Apparently, while `httplib` itself doesn't care about the square brackets, the `match_hostname` function needs them gone. I suggest we move the stripping down into our `ssl.py` module.
Proof / Evidence
- GitHub issue: #760
- Fix PR: https://github.com/urllib3/urllib3/pull/761
- First fixed release: 1.25
- 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.76
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“This is the openstack bug, FYI: https://bugs.launchpad.net/nova/+bug/1526413”
“@Lukasa seems to be working on this so I'm labelling it in progress and assigning him :-P”
Failure Signature (Search String)
- Apparently, while `httplib` itself doesn't care about the square brackets, the `match_hostname` function needs them gone. I suggest we move the stripping down into our `ssl.py`
Copy-friendly signature
Failure Signature
-----------------
Apparently, while `httplib` itself doesn't care about the square brackets, the `match_hostname` function needs them gone. I suggest we move the stripping down into our `ssl.py` module.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Apparently, while `httplib` itself doesn't care about the square brackets, the `match_hostname` function needs them gone. I suggest we move the stripping down into our `ssl.py` module.
What Broke
Users experience SSL validation failures with IPv6 addresses due to incorrect formatting.
Why It Broke
The match_hostname function fails to handle IPv6 addresses with square brackets
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install urllib3==1.25
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/761
First fixed release: 1.25
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not apply this fix if the hostname is not an IPv6 address.
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.
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
Version Compatibility Table
| Version | Status |
|---|---|
| 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.