title: Returning 400 in virtual host environments where Host header has no match
body: <p>Consider a web server from which three virtual hosts are served:</p>
  
  <ul>
  <li>mysite.com</li>
  <li>myothersite.com</li>
  <li>imnotcreative.com</li>
  </ul>
  
  <p>Now assume that the server receives the following raw request message (code formatting removes the terminating <code>\r\n</code> sequences):</p>
  
  <pre><code>GET / HTTP/1.1
  Host: nothostedhere.com
  </code></pre>
  
  <p>I haven't see any guidance in RFC 2616 (perhaps I missed it?) on how to respond to a request for a host name that does not exist at the current server. Apache, for example, will simply use the first virtual host defined in its configuration as the "primary host" and pretend the client requested that host. Obviously this is more robust than returning a <code>400 Bad Request</code> response and guarantees the client always sees <em>some</em> representation.</p>
  
  <p><strong>So my question is ...</strong></p>
  
  <p>Can anyone provide reasons aside from the "robustness vs. correctness" argument to dissuade me from responding with a <code>400</code> (or other error code) should the client request a non-existent host when employing the HTTP/1.1 protocol?</p>
  
  <hr>
  
  <p>Note that all HTTP/1.1 requests <em>MUST</em> specify a <code>Host:</code> header as per RFC 2616. For HTTP/1.0 requests the only real option is to serve the "primary" host result. This question specifically addresses HTTP/1.1 protocol requests.</p>