<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">Так нужно, чтобы merge_slashes был выключен только  на http://127.0.0.1, а на всех остальных, где будет выбор хоста по SNI - включен. Грубо - устроит на всех http выключен, а на всех https включен.</div><div dir="ltr"><br><blockquote type="cite">On 30 May 2024, at 17:36, Roman Arutyunyan <arut@nginx.com> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><meta http-equiv="content-type" content="text/html; charset=utf-8">Добрый день,<br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On 29 May 2024, at 9:53 PM, Vladimir Sopot <jd@artdesign.ru> wrote:</div><br class="Apple-interchange-newline"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">И как быть, если мне в одном из серверов необходимо иметь два подряд идущих слэша? Это purge для кэша, который зависит от cookies пользователя, которые, естественным образом могут быть пустыми.<br id="lineBreakAtBeginningOfMessage"></div></div></blockquote><div><br></div><div>Самый простой способ - использовать TLS с SNI. В таком случае выбор сервера  будет происходить на этапе хендшейка TLS.</div><div><br></div><div>Теоретически можно изменить поведение nginx таким образом, чтобы при указании полного uri в строке запроса выбор сервера происходил до обработки uri, и это вам поможет.</div><div>Но это требует осторожности и анализа возможных последствий. И в этом случае marge_slashes будет работать по-разному в строке запроса и в заголовке Host, что тоже не очень хорошо.</div><div><br></div><blockquote type="cite"><div><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br><blockquote type="cite"><div>On 24 Apr 2024, at 19:24, Roman Arutyunyan <arut@nginx.com> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Добрый день,</span><br id="lineBreakAtBeginningOfMessage" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br><blockquote type="cite"><div>On 16 Apr 2024, at 11:41 PM, Vladimir Sopot <<a href="mailto:jd@artdesign.ru">jd@artdesign.ru</a>> wrote:</div><br class="Apple-interchange-newline"><div><div>Здравствуйте!<br><br>Есть примерно такой упрощённый конфиг и при обращении к some.local////////some.html merge_slashes не работает. Если в первом сервере убрать merge_slashes off, то всё работает нормально и во втором сервере.<span class="Apple-converted-space"> </span><br>Почему так? nginx version: nginx/1.25.3<br></div></div></blockquote><div><br></div>На момент парсинга строки запроса, nginx еще не знает о том, какой виртуальный сервер будет выбран и использует настройки дефолтного.</div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br></div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">Если вы включите ssl, то ситуация будет другой.</div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br><blockquote type="cite"><div><div><br>http {<br><span class="Apple-tab-span" style="white-space: pre;">       </span>merge_slashes on;<br><span class="Apple-tab-span" style="white-space: pre;">       </span>}<br><br>server {<br><span class="Apple-tab-span" style="white-space: pre;">   </span>listen 127.0.0.1:80 default_server;<span class="Apple-tab-span" style="white-space: pre;">       </span><br><span class="Apple-tab-span" style="white-space: pre;">        </span>server_name 127.0.0.1 _ "";<br><br><span class="Apple-tab-span" style="white-space: pre;"> </span>merge_slashes off;<br><span class="Apple-tab-span" style="white-space: pre;">      </span>allow 127.0.0.1;<br><span class="Apple-tab-span" style="white-space: pre;">        </span>deny all;<br><br>      location /nginx_status {<br>          stub_status on;<br>          }<br><br>…. много location<br><br><span class="Apple-tab-span" style="white-space: pre;">     </span>}<br><br>server {<br>      listen *:80;<br>      server_name  some.local;<br><br>…. много location<br><br><span class="Apple-tab-span" style="white-space: pre;">        </span>}<br><br>Best, VS<br>_______________________________________________<br>nginx-ru mailing list<br>nginx-ru@nginx.org<br>https://mailman.nginx.org/mailman/listinfo/nginx-ru<br></div></div></blockquote></div><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>----</div><div>Roman Arutyunyan</div><div><a href="mailto:arut@nginx.com">arut@nginx.com</a></div><div><br></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"></div><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">nginx-ru mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="mailto:nginx-ru@nginx.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">nginx-ru@nginx.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="https://mailman.nginx.org/mailman/listinfo/nginx-ru" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://mailman.nginx.org/mailman/listinfo/nginx-ru</a></div></blockquote></div><br></div>_______________________________________________<br>nginx-ru mailing list<br>nginx-ru@nginx.org<br>https://mailman.nginx.org/mailman/listinfo/nginx-ru<br></div></blockquote></div><br><div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div>----</div><div>Roman Arutyunyan</div><div>arut@nginx.com</div><div><br></div></div><br class="Apple-interchange-newline"><br class="Apple-interchange-newline">

</div>
<br><span>_______________________________________________</span><br><span>nginx-ru mailing list</span><br><span>nginx-ru@nginx.org</span><br><span>https://mailman.nginx.org/mailman/listinfo/nginx-ru</span><br></div></blockquote></body></html>