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.

What is the mandatory information a HTTP Request Header must contain ?

share|improve this question

2 Answers 2

GET / HTTP/1.0 is a legal HTTP request.

If there's no Host header field, you may not get the results you were hoping for if the destination server is a virtual host that doesn't have its own IP address to distinguish itself from other virtual hosts.

HTTP 1.1 requires the Host field.

share|improve this answer
    
I did a bit research myself and you are right @gbroiles. For Name Based Virtual Hosting a Browser with HTTP 1.1 is required in general. The browsers sends the hostname in the host header and the Web server serves name based virtual hosts if configured. With older browsers and HTTP 1.0 that is somewhat possible, but you need a workaround like apache's ServerPath Directive. Luckily newer browsers implement extensions when using HTTP 1.0 to ensure sending the host header field. w3.org/Protocols/rfc2616/rfc2616-sec14.html –  Stephan Kristyn Jul 28 '10 at 22:54
    
Are there still browsers that actually do HTTP 1.0? –  Pacerier Mar 9 '13 at 4:44

None of the HTTP Headers are required in a Request. There are no required Response headers either.

All that and more in HTTP 1.1 - RFC 2616

share|improve this answer
1  
You're mistaken. According to the RFC you linked here: "A client MUST include a Host header field in all HTTP/1.1 request messages". So the Host header is mandatory. –  Tomas Nov 27 '12 at 11:27
2  
Correct, but there's no requirement that a client use HTTP/1.1 in the first place. –  Chris S Nov 27 '12 at 14:45
    
Content-Length or Transfer-Encoding is mandatory (either of them must be present) –  Roel van Uden Jun 16 '13 at 15:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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