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

Igor Sysoev is at rambler-co.ru
Tue Oct 27 13:32:25 MSK 2009


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;


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list