LMSouq
server-admin Open

Why do HTTP servers forbid underscores in HTTP header names

WH
white
1 month ago
3 views
Problem Description
I had a problem with a custom HTTP `SESSION_ID` header not being transfered by nginx proxy. I was told that underscores are prohibited according to the HTTP RFC. Searching, I found that most servers like [Apache][1] or [nginx][2] define them as illegal in [RFC2616][3] section 4.2, which says: > follow the same generic format as that given in Section 3.1 of RFC 822 [9] [RFC822][4] says: > The field-name must be composed of printable ASCII characters (i.e., characters that have values between 33. and 126., decimal, except colon) Underscore is decimal character 95 in the ASCII table in the 33-126 range. What am I missing? [1]: http://httpd.apache.org/docs/trunk/new_features_2_4.html [2]: http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers [3]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 [4]: http://www.ietf.org/rfc/rfc822.txt

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base