Why is redirect to the first server_name happening when visiting location without trailing slash?

Igor Katson descentspb at gmail.com
Tue Oct 27 16:49:15 MSK 2009


Igor Sysoev wrote:
> On Tue, Oct 27, 2009 at 01:25:47PM +0300, Igor Katson wrote:
> 
>> I have a following site config in nginx
>>
>> server {
>>          listen 80;
>>          server_name testsite.local nginx.test;
>>
>>          root /tmp;
>>
>>          location /video/ {
>>                  proxy_pass http://localhost:8080/;
>>          }
>> }
>>
>> and the following line in /etc/hosts
>>
>> 127.0.0.1	localhost testsite.local nginx.test
>>
>> When i visit http://nginx.test/video , nginx redirects me to 
>> http://testsite.local/video/, which is the behaviour, I don't expect at 
>> all. It would be nice to redirect the same way, but to the same host, or 
>>   not redirect at all.
>>
>> How can I disable that behavior?
> 
> server_name_in_redirect  off;
> 
> 
Thank you, Igor. My mistake not looking in the docs first.





More information about the nginx mailing list