{"id":508,"date":"2009-09-25T21:27:56","date_gmt":"2009-09-25T13:27:56","guid":{"rendered":"http:\/\/blog.lolyco.com\/sean\/?p=508"},"modified":"2009-09-25T21:30:01","modified_gmt":"2009-09-25T13:30:01","slug":"correct-response-for-wrong-host-field-in-http-request-header","status":"publish","type":"post","link":"https:\/\/blog.lolyco.com\/sean\/2009\/09\/25\/correct-response-for-wrong-host-field-in-http-request-header\/","title":{"rendered":"Correct response for wrong Host: field in HTTP request header"},"content":{"rendered":"<p>Still frantically trying to get Spinneret into shape for a first open-source release. I&#8217;m also working on a new project that I&#8217;m quite excited about, which is providing plenty of examples of where Spinneret could be improved!<\/p>\n<p>The new project is hosted on a VPS at <a title=\"VPSLink - Xen VPS hosting\" href=\"http:\/\/vpslink.com\/\">VPSLink<\/a> (recommended, so far!). Today&#8217;s curve ball was Google&#8217;s googlebot requesting pages that belonged to the previous owner of the IP address. I could see the previous domain name in the debug output in the <a title=\"HTTP Host header field\" href=\"http:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec14.html#sec14.23\">&#8216;Host:&#8217; request header field<\/a>. Almost every request from the googlebot was causing my server to return a 404 &#8211; the URLs were all from the previous domain&#8217;s site.<\/p>\n<p>In the interests of not cluttering up search indexes with my content duplicated for an expired domain, I decided that my new site should just plain reject requests for other hosts identified in the Host: header. I couldn&#8217;t decide which 4XX error it should be, but finally I decided to send the <a href=\"http:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html#sec10.4.4\">403 (Forbidden) status code<\/a>, with an explanation that the Host: header field was what caused the problem.<\/p>\n<p>A quick search turned up nothing &#8211; I could annoy some admins by using <a href=\"http:\/\/curl.haxx.se\/\">cURL<\/a> to send some wrong Host: fields to various sites, but I don&#8217;t really have the time. I&#8217;d be delighted if anyone could upgrade my ignorance!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Still frantically trying to get Spinneret into shape for a first open-source release. I&#8217;m also working on a new project that I&#8217;m quite excited about, which is providing plenty of examples of where Spinneret could be improved! The new project is hosted on a VPS at VPSLink (recommended, so far!). Today&#8217;s curve ball was Google&#8217;s [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,31,3,45],"tags":[44,41,34,18,57],"class_list":["post-508","post","type-post","status-publish","format-standard","hentry","category-broken","category-hardware","category-software","category-spinneret","tag-brokenfixed","tag-http","tag-network","tag-server","tag-web"],"_links":{"self":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/comments?post=508"}],"version-history":[{"count":5,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/508\/revisions"}],"predecessor-version":[{"id":512,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/posts\/508\/revisions\/512"}],"wp:attachment":[{"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/media?parent=508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/categories?post=508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.lolyco.com\/sean\/wp-json\/wp\/v2\/tags?post=508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}