<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Sep 5, 2018 at 3:25 PM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<span class=""></span><br><span class=""></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
On Wed, Sep 05, 2018 at 09:58:54AM +0300, Peter Volkov wrote:<br>
<br>
> Hi. Could you, please, explain. Why nginx sends 301 redirect for the<br>
> following vhost:<br>
> <br>
> server {<br>
>     listen 80;<br>
</span>>     server_name <a href="http://test.domain.tv" rel="noreferrer" target="_blank">test.domain.tv</a> <<a href="http://test.m9.smotreshka.tv" rel="noreferrer" target="_blank">http://test.m9.smotreshka.tv</a>><wbr>;<br>
<span class="">> <br>
>     access_log off;<br>
> <br>
>     location = /test/README.txt {<br>
>         alias /var/www/;<br>
>     }<br>
> }<br>
> <br>
> Here is redirect:<br>
> <br>
>  $ http <a href="http://test.domain.tv/test/README.txt" rel="noreferrer" target="_blank">http://test.domain.tv/test/<wbr>README.txt</a><br>
> HTTP/1.1 301 Moved Permanently<br>
> Connection: keep-alive<br>
> Content-Length: 178<br>
> Content-Type: text/html<br>
> Date: Wed, 05 Sep 2018 06:55:27 GMT<br>
> Keep-Alive: timeout=20<br>
> Location: <a href="http://test.domain.tv/test/README.txt/" rel="noreferrer" target="_blank">http://test.domain.tv/test/<wbr>README.txt/</a><br>
> Server: nginx<br>
> <br>
> <html><br>
> <head><title>301 Moved Permanently</title></head><br>
> <body bgcolor="white"><br>
> <center><h1>301 Moved Permanently</h1></center><br>
> <hr><center>nginx</center><br>
> </body><br>
> </html><br>
<br>
</span>You've aliased "/test/README.txt" into a directory "/var/www/".  <br>
Since the URI "/test/README.txt" does not have a trailing slash, <br>
nginx returns a redirect with a trailing slash added, much like it <br>
does when requesting a directory without a trailing shash.<br>
<span class="HOEnZb"></span></blockquote><div><br></div><div>Thank you, Maxim. That was the problem!</div><div><br></div><div>--<br></div><div>Peter.<br></div></div></div></div>