HTTP headers in lower case - why?

zEitEr

New Member
#1
Hello,

Configured an OpenLiteSpeed to work as a reverse proxy for CSF/LFD UI per available guides

OLS_External App_Rewrite_3.png OLS_External App_2.png OLS_External App_1.png

And I found an issue with HTTP-headers, which are get in a lower case by a Perl script.

Code:
Mar  1 20:11:23 server2 lfd[790325]: UI debug: header [host] [127.0.0.1:1035]
Mar  1 20:11:23 server2 lfd[790325]: UI debug: header [content-length] [36]
Mar  1 20:11:23 server2 lfd[790325]: UI debug: header [content-type] [application/x-www-form-urlencoded]
I wonder, whether is it a bug? Or a designed behaviour? If the second, how can I change this behaviour?

Regards,
Alex.
 

LiteCache

Active Member
#2

zEitEr

New Member
#3
OK, Let's check it out. My browser sends the following headers:

Code:
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Cache-Control: max-age=0
Content-Length: 28
Content-Type: application/x-www-form-urlencoded
and a Perl application gets HTTP-headers with lower-cased names.

Code:
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [content-length] [33]
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [cache-control] [max-age=0]
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [content-type] [application/x-www-form-urlencoded]
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [user-agent] [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 OPR/107.0.0.0]
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [accept] [text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7]
Extra headers added by OpenLiteSpeed are still capitalized:

Code:
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [X-Forwarded-Host] [server2.servername.example:7000]
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [X-Forwarded-Proto] [https]
Mar  4 16:16:31 server2 lfd[841060]: UI debug: header [X-Forwarded-For] [37.xxx.xxx.215]
Is it a half-working standard?

Just as in HTTP/1.x, header field names are strings of ASCII
characters that are compared in a case-insensitive fashion. However,
header field names MUST be converted to lowercase prior to their
encoding in HTTP/2. A request or response containing uppercase
header field names MUST be treated as malformed (Section 8.1.2.6).
OK, whatever it can be... Can we make OpenLiteSpeed to send capitalized HTTP-header names?
I already tried to use a RequestHeader Directive and failed to get an original value of headers.

Kindly advice.
 

LiteCache

Active Member
#4
Can we make OpenLiteSpeed to send capitalized HTTP-header names?
Response headers are not request headers. The RFC specification refers to response headers. Browsers send request headers in upper case for traditional reasons.

If the specification states that response headers must be lower case, then you should not expect LiteSpeed to deviate from this requirement.
 
Top