Header name lowercase requirement is excessive
See original GitHub issueIt was pointed out in https://code.djangoproject.com/ticket/32586 that the initial ASGI requirement that header names in responses MUST be lowercased - inherited from ASGI 1, I believe - doesn’t actually match the Django codebase, and upon inspection, this is because, unfortunately, a very small number of HTTP clients are case-sensitive to headers like Content-Type
.
I believe the appropriate action is to relax the MUST requirement, and say that servers can/should try to preserve case when passed to them, but nothing requires it; this saves us from entirely flipping the expectation here. Thoughts?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Are HTTP headers case-sensitive? - Stack Overflow
HTTP header names are case-insensitive, according to RFC 2616: 4.2: Each header field consists of a name followed by a colon (":") and...
Read more >Capitalization | Google developer documentation style guide
If an official name begins with a lowercase letter, then put it in lowercase even at the start of a sentence. But it's...
Read more >RFC 1035: Domain names - implementation and specification
1. Preferred name syntax The DNS specifications attempt to be as general as possible in the rules for constructing domain names. · 2....
Read more >Preserve Header Case configuration not honored at redirect ...
You have an HTTP Request with headers that are case-sensitive (uppercase, lowercase, or a combination of them). The HTTP Request is configured ...
Read more >Fetch Standard
Return the result of convert header names to a sorted-lowercase set with unsafeNames . A CORS non-wildcard request-header name is a header name...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve a request not to lowercase the incoming headers for a use case whereby Hypercorn is used as a proxy and the casing is sensitive downstream. Not lower-casing, does however cause some bugs e.g. https://github.com/pgjones/hypercorn/issues/77. I’m not sure what the least unpleasant solution is.
Yes, this is not for incoming request headers, but for outgoing request headers. I agree that all incoming ones should be lowercased; it’s the response headers that it seems we occasionally need to keep case sensitivity.
How about this wording instead: