Are HTTP headers (Content-Type, &c.) case-sensitive?

anonymous coward picture anonymous coward · Oct 10, 2011 · Viewed 20.4k times · Source

Perhaps I'm skimming too fast, but couldn't find this specifically documented. In my particular case, I'm wondering about the "Content-Type" header, but I'm assuming the same rules would apply to other standard headers.

Are these case sensitive, and if so: Is it Content-Type or Content-type?

Is there a proper place to reference these?

Answer

Roman R. picture Roman R. · Oct 10, 2011

Case-insensitive.

Hypertext Transfer Protocol -- HTTP/1.1:

4.2 Message Headers

HTTP header fields, which include general-header (section 4.5), request-header (section 5.3), response-header (section 6.2), and entity-header (section 7.1) fields, follow the same generic format as that given in Section 3.1 of RFC 822 [9]. Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive.