<div dir="ltr">Не понял в чем проблема, чисто наитием использую давно:<div><div><br></div><div># Add default fake server</div><div>include /..../default_server.conf;</div></div><div><br></div><div>где default_server.conf:</div>
<div>=================</div><div><br></div><div><div>server {</div><div><span class="" style="white-space:pre"> </span>listen *:80 default_server;</div><div><span class="" style="white-space:pre">        </span>server_name _;</div>
<div><span class="" style="white-space:pre">    </span>return 403;</div><div>}     </div></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-11 15:25 GMT+04:00 Gena Makhomed <span dir="ltr"><<a href="mailto:gmm@csdoc.com" target="_blank">gmm@csdoc.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 11.06.2014 13:42, Валентин Бартенев wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="http://habrahabr.ru/post/166855/" target="_blank">http://habrahabr.ru/post/<u></u>166855/</a><br>
</blockquote></blockquote></blockquote></blockquote></blockquote>
<br>
Единственный правильный способ: пойти в IETF с предложением исправить<br>
соответствующие RFC, которые в том числе оговаривают, что следует делать<br>
при получении нескольких заголовков Host, ну а потом уже сюда.<br>
</blockquote>
<br>
<a href="http://tools.ietf.org/html/rfc7230#section-5.4" target="_blank">http://tools.ietf.org/html/<u></u>rfc7230#section-5.4</a><br>
<br>
     When a proxy receives a request with an absolute-form of<br>
     request-target, the proxy MUST ignore the received Host header field<br>
     (if any) and instead replace it with the host information of the<br>
     request-target.  A proxy that forwards such a request MUST generate a<br>
     new Host field-value based on the received request-target rather than<br>
     forward the received Host field-value.<br>
<br>
Referer: <a href="http://www.opennet.ru/opennews/art.shtml?num=39956" target="_blank">http://www.opennet.ru/<u></u>opennews/art.shtml?num=39956</a><br>
</blockquote>
<br>
Не очень понятно, а что хотели сказать этой цитатой?<br>
<br>
Так, на всякий случай, nginx не является "proxy" согласно терминологии того<br>
же RFC 7230.<br>
</blockquote>
<br></div>
Ok.<br>
<br>
<a href="http://tools.ietf.org/html/rfc7230#section-5.4" target="_blank">http://tools.ietf.org/html/<u></u>rfc7230#section-5.4</a><br>
<br>
   A server MUST respond with a 400 (Bad Request) status code to any<br>
   HTTP/1.1 request message that lacks a Host header field and to any<br>
   request message that contains more than one Host header field or a<br>
   Host header field with an invalid field-value.<br>
<br>
"invalid field-value" - это в том числе, когда клиент не выполняет требований, которые изложены выше в этом же документе:<br>
<br>
   A client MUST send a Host header field in all HTTP/1.1 request<br>
   messages.  If the target URI includes an authority component, then a<br>
   client MUST send a field-value for Host that is identical to that<br>
   authority component, excluding any userinfo subcomponent and its "@"<br>
   delimiter (Section 2.7.1).<br>
<br>
следовательно, если приходит запрос<br>
<br>
GET <a href="http://example.com/" target="_blank">http://example.com/</a> HTTP/1.1<br>
Host: <a href="http://example.org" target="_blank">example.org</a><br>
<br>
- это "Host header field with an invalid field-value"<br>
и nginx "MUST respond with a 400 (Bad Request) status code".<br>
<br>
Если такой запрос приходит по HTTP/1.0 - в этой версии<br>
протокола нет absolute-form и тоже надо отвечать 400 статусом.<br>
<br>
текущее поведение nginx не соответствует требованиям RFC 7230 ?<br>
<br>
P.S.<br>
<br>
и да, отвечать с 400 статусом тут даже более логично,<br>
потому что если authority component в строке запроса<br>
и в заголовке Host: разные - это явно попытка взлома.<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Best regards,<br>
 Gena</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
nginx-ru mailing list<br>
<a href="mailto:nginx-ru@nginx.org" target="_blank">nginx-ru@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-ru" target="_blank">http://mailman.nginx.org/<u></u>mailman/listinfo/nginx-ru</a></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Dmitry Goryainov<br>
<br>
</div>