The Fix
pip install urllib3==1.25
Based on closed urllib3/urllib3 issue #1466 · 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%.
@@ -158,6 +158,12 @@ def test_getlist(self):
self.assertEqual(self.d.getlist('b'), [])
+ def test_update(self):
+ d = HTTPHeaderDict()
+ d.update(self.d)
Option A — Upgrade to fixed release\npip install urllib3==1.25\nWhen NOT to use: This fix is not applicable if the server correctly handles multiple headers.\n\n
Why This Fix Works in Production
- Trigger: Since the field-value for HSTS is not defined as a comma-separated list and since doing this does change the semantics of the message (by resulting in an…
- Mechanism: urllib3 incorrectly folds multiple HTTP headers into a single header, violating HTTP specifications
- Why the fix works: Replaces the concatenation and splitting of HTTP headers with proper collection handling, addressing the issue of incorrect header folding in urllib3. (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
- urllib3 incorrectly folds multiple HTTP headers into a single header, violating HTTP specifications
- Production symptom (often without a traceback): Since the field-value for HSTS is not defined as a comma-separated list and since doing this does change the semantics of the message (by resulting in an invalid HSTS header), this concatenation shouldn't be happening.
Proof / Evidence
- GitHub issue: #1466
- Fix PR: https://github.com/urllib3/urllib3/pull/534
- 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).
“that's my understanding too”
“thanks for your time and for pointing me in the right direction.”
“Sorry, the method is actually getlist (see also: https://github.com/urllib3/urllib3/blob/f8d1c787d9b02a70d66ddbde9c99061d9073d54a/src/urllib3/_collections.py#L251)”
“Oh and there are other backwards-compatible shims too: https://github.com/urllib3/urllib3/blob/f8d1c787d9b02a70d66ddbde9c99061d9073d54a/src/urllib3/_collections.py#L263..L269”
Failure Signature (Search String)
- Since the field-value for HSTS is not defined as a comma-separated list and since doing this does change the semantics of the message (by resulting in an invalid HSTS header),
Copy-friendly signature
Failure Signature
-----------------
Since the field-value for HSTS is not defined as a comma-separated list and since doing this does change the semantics of the message (by resulting in an invalid HSTS header), this concatenation shouldn't be happening.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Since the field-value for HSTS is not defined as a comma-separated list and since doing this does change the semantics of the message (by resulting in an invalid HSTS header), this concatenation shouldn't be happening.
What Broke
This causes issues with HSTS, leading to potential security vulnerabilities.
Why It Broke
urllib3 incorrectly folds multiple HTTP headers into a single header, violating HTTP specifications
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/534
First fixed release: 1.25
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if the server correctly handles multiple headers.
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
| 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.