Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

One thing I've noticed about CloudFlare and Google's web servers are that they both use lowercase response headers. Is this just for looks, or does it actually provide a performance increase? I'm considering doing it for my custom nginx build, but as of now, I am not exactly sure if there will be any negative/positive consequences. I am aware that the RFC 2616 spec on HTTP 1.1 says that headers are case insensitive, so I am sure that it wouldn't cause any issues otherwise Google and CloudFlare wouldn't be using them.

Example response headers from google.com:

HTTP/1.1 200 OK
status: 200 OK
version: HTTP/1.1
cache-control: private, max-age=0
content-encoding: gzip
content-type: text/html; charset=UTF-8
date: Tue, 22 Jan 2013 20:58:07 GMT
expires: -1
server: gws
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
share|improve this question

closed as not constructive by Zoredache, Michael Hampton, Dave M, RobM, Ward Jan 23 '13 at 0:02

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I can't imagine what performance increase you think you would get by having headers with a different case. –  Zoredache Jan 22 '13 at 21:05
    
That's what I was asking. There must be some reason that the both of them do that. –  Kevin Smith Jan 22 '13 at 21:06
1  
No, there doesn't need to a reason any more the to say the developers liked it, or they both use some common library, or piece of software. –  Zoredache Jan 22 '13 at 21:12
    
Can't you just buy more servers? –  Joel E Salas Jan 22 '13 at 21:51
    
sigh Yes, you could buy more servers. –  Kevin Smith Jan 22 '13 at 22:24

1 Answer 1

As you pointed out, per RFC 2616 HTTP Headers (indeed, many things in the protocol) are case insensitive.
You can camelCase or InterCap for readability, Or YoU CaN TyPe ThEm LiKe ThIs and annoy anyone who has to debug your HTTP exchanges.

Google and CloudFlare use the SPDY protocol (next to HTTP) which explicitly requires lower case headers.

Lower case characters are faster to type (not requiring a shift key), and may save a whole second in the course of development, but using them will have zero impact on performance - lower-case letters aren't any "smaller" on the wire than upper-case ones.


If you know everything is going to be lower-case you can avoid case-insensitive parsing/comparisons in your software, trading robustness (and RFC conformance) for marginal speed gains.
This is certainly not a GOOD idea though (you don't know what your clients are going to send). I wouldn't muck with the header handling in nginx at all, absent a really good reason to do so. It's been written, it works, and you're more likely to break something than improve anything if you start mucking about with it.

share|improve this answer
    
Did you mean for this to be CW? –  Mark Henderson Jan 22 '13 at 22:37
1  
yeah, no sense rep whoring when he answered his own question in his question. –  voretaq7 Jan 22 '13 at 23:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.