URL rewrite plus proxy pass problem

Toby DiPasquale codeslinger at gmail.com
Tue Jul 31 00:47:59 MSD 2007


Hi all,

I'm using nginx and what I'd like to occur is the following: I'd like
to host multiple apps, each hosted on their own Web server on
different ports on the local machine. I'd like for nginx to proxy
between these apps based on an URL path prefix, e.g.

http://localhost/path/place?query=1  -->  http://localhost:8080/place?query=1

My config is pretty simple and looks like:

location / {
    root			/var/www/html;
}
location /path/ {
    rewrite   ^/path/(.*)$	$1	break;
    proxy_pass			http://127.0.0.1:8080;
}

However, when I click on an href="/path" link, I am sent back to the
index page. Why is it not proxying the rewritten URL back to the
instance on port 8080? How can I make it do that? Thanks for all your
help.

-- 
Toby DiPasquale





More information about the nginx mailing list