proxy_pass bug

Maxim Dounin mdounin at mdounin.ru
Sat Nov 14 19:54:18 MSK 2009


Hello!

On Sat, Nov 14, 2009 at 10:16:36AM -0500, supeng wrote:

> I have a tomcat server  bind localhost:8080, and my nginx 0.8.24's conf is 
> ======================================
> ... ...
> 
>     server {
>         listen       80;
>         server_name  localhost;
> 
>         location / {
> 		proxy_pass http://localhost:8080;
> 	}
>     }
> ... ...
> ======================================
> when I access http://mydomain/docs, the url will be redirected to http://localhost/docs. Of course, the url, http://mydomain/docs/ , is working correctly!

http://wiki.nginx.org/NginxHttpProxyModule#proxy_redirect
http://wiki.nginx.org/NginxHttpCoreModule#server_name_in_redirect

In your case proxy_redirect default should be ok as long as you 
set correct server_name, i.e.

    server_name  mydomain;

or use

    server_name_in_redirect off;

Maxim Dounin





More information about the nginx mailing list