3 messages in ru.sysoev.nginxRe: URL rewrite plus proxy pass problem
FromSent OnAttachments
Toby DiPasqualeJul 30, 2007 1:47 pm 
RoxisJul 30, 2007 1:55 pm 
Wayne E. SeguinJul 30, 2007 2:13 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: URL rewrite plus proxy pass problemActions...
From:Wayne E. Seguin (wayn@public.gmane.org)
Date:Jul 30, 2007 2:13:56 pm
List:ru.sysoev.nginx

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 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.

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.