Why it is converting to lowercase? In Firefox it goes as: "X-Requested-With". While in IE, it goes as: "x-requested-with"
-
Why do you care? HTTP headers are case insensitive. Also, you may want to add more detail to your question. Code examples, exactly where you detect that the case of the header has changed, etc. – Martijn Pieters Jul 15 '09 at 10:19
-
It would be helpful to know at what point it becomes lowercase. For instance, watch on the wire with a network debugger like Fiddler. – EricLaw Jul 16 '09 at 03:39
2 Answers
The HTTP method is supposed to be case-sensitive, but the HTTP headers are supposed to be case-insensitive, according to RFC 2616.

- 2,637
- 2
- 24
- 27
-
12
-
I guess so! I know that when it comes to HTTP headers, Microsoft (IE & IIS) like to make everything lower case. No idea why, but would guess that it's for something in the internals of IIS. – Kieran Hall Jul 15 '09 at 15:13
-
The OP didn't ask about the HTTP method. He asked about the HTTP headers. – PHP Guru Sep 18 '20 at 18:43
I had noticed something similar. Take a look at the sample code and what it does when I add some custom HTTP headers. First is the JavaScript code and then is the Fiddler dump (custom headers only) from IE8, Safari4 and Firefox3. Notice that Firefox honors case, IE converts to lowercase and Safari converts to propercase.
However, as already mentioned, these are treated as case insensitive by the server so it really doesn't matter.
function doXHR() {
var request = new XMLHttpRequest();
request.open('GET', '/header/header.txt');
request.setRequestHeader('x-lowercase', 'X-lowercase');
request.setRequestHeader('x-Propercase', 'X-Propercase');
request.setRequestHeader('x-CamelCase', 'X-CamelCase');
request.setRequestHeader('x-UPPERCASE', 'X-UPPERCASE');
request.onreadystatechange = function() {
if (request.readyState == 4) {
console.log('Received XMLHttpRequest callback: \n' + request.responseText);
}
};
request.send("");
}
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
x-lowercase: X-lowercase
x-camelcase: X-CamelCase
x-uppercase: X-UPPERCASE
x-propercase: X-Propercase
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Safari/528.17
X-Lowercase: X-lowercase
X-Uppercase: X-UPPERCASE
X-Camelcase: X-CamelCase
X-Propercase: X-Propercase
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)
x-lowercase: X-lowercase
x-Propercase: X-Propercase
x-CamelCase: X-CamelCase
x-UPPERCASE: X-UPPERCASE

- 41,386
- 23
- 126
- 155