Jump to solution
Verify

The Fix

Upgrade to version 0.49.0 or later.

Based on closed Kludex/starlette issue #2977 · 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
@@ -140,10 +140,11 @@ def path_params(self) -> dict[str, Any]: if not hasattr(self, "_cookies"): cookies: dict[str, str] = {} - cookie_header = self.headers.get("cookie") + cookie_headers = self.headers.getlist("cookie") +
repro.py
... If there are multiple Cookie header fields after decompression, these MUST be concatenated into a single octet string using the two-octet delimiter of 0x3B, 0x20 (the ASCII string "; ") before being passed into a non-HTTP/2 context, such as an HTTP/1.1 connection, or a generic HTTP server application. Therefore, the following two lists of Cookie header fields are semantically equivalent. cookie: a=b; c=d; e=f cookie: a=b cookie: c=d cookie: e=f
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.49.0 or later.\nWhen NOT to use: This fix should not be applied if the application does not require support for multiple cookie headers.\n\n

Why This Fix Works in Production

  • Trigger: Request Header cookie parsing doesn't follow RFC 7540 spec
  • Mechanism: The code only retrieves the first cookie header instead of concatenating multiple headers as required by RFC 7540
  • Why the fix works: Supports multiple cookie headers in the Request.cookies method, ensuring they are concatenated as per RFC 7540. (first fixed release: 0.49.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

  • The code only retrieves the first cookie header instead of concatenating multiple headers as required by RFC 7540
  • Production symptom (often without a traceback): Request Header cookie parsing doesn't follow RFC 7540 spec

Proof / Evidence

  • GitHub issue: #2977
  • Fix PR: https://github.com/kludex/starlette/pull/3029
  • First fixed release: 0.49.0
  • 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.56

Discussion

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

“It seems we need to use getlist instead there. Weird that I didn't see this before. It seems the code we have was inspired by…”
@Kludex · 2025-08-08 · source
“Hi, I’d like to work on this issue”
@Pravindgholap · 2025-08-08 · source

Failure Signature (Search String)

  • Request Header cookie parsing doesn't follow RFC 7540 spec
  • It seems the code we have was inspired by Django 3.1.0, so maybe we can check if Django changed something.
Copy-friendly signature
signature.txt
Failure Signature ----------------- Request Header cookie parsing doesn't follow RFC 7540 spec It seems the code we have was inspired by Django 3.1.0, so maybe we can check if Django changed something.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Request Header cookie parsing doesn't follow RFC 7540 spec It seems the code we have was inspired by Django 3.1.0, so maybe we can check if Django changed something.

Minimal Reproduction

repro.py
... If there are multiple Cookie header fields after decompression, these MUST be concatenated into a single octet string using the two-octet delimiter of 0x3B, 0x20 (the ASCII string "; ") before being passed into a non-HTTP/2 context, such as an HTTP/1.1 connection, or a generic HTTP server application. Therefore, the following two lists of Cookie header fields are semantically equivalent. cookie: a=b; c=d; e=f cookie: a=b cookie: c=d cookie: e=f

What Broke

Only the first cookie is processed, leading to potential data loss in cookie information.

Why It Broke

The code only retrieves the first cookie header instead of concatenating multiple headers as required by RFC 7540

Fix Options (Details)

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

Upgrade to version 0.49.0 or later.

When NOT to use: This fix should not be applied if the application does not require support for multiple cookie headers.

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

Fix reference: https://github.com/kludex/starlette/pull/3029

First fixed release: 0.49.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

  • This fix should not be applied if the application does not require support for multiple cookie headers.

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

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

Version Compatibility Table

VersionStatus
0.49.0 Fixed

Related Issues

No related fixes found.

Sources

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