URL rewrite plus proxy pass problem

Wayne E. Seguin wayneeseguin at gmail.com
Tue Jul 31 01:14:19 MSD 2007

On Jul 30, 2007, at 16:47 , Toby DiPasquale wrote:
> 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;
> }
> 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.

I may be incorrect yet I think that the / location gets picked up and  
processed for /path before the /path/ one hence you're hitting your  
index page. So try reversing the order of the location statements  
with location / last.

Wayne E. Seguin
Sr. Systems Architect & Systems Admin
wayneseguin at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070730/d6804150/attachment.html>

More information about the nginx mailing list