Url changed in proxy_pass

I have nginx installed on port 80 and apache is installed on port 81. I
proxy php to apache and have nginx handle all the static and image
content.

On my config I have an if statment similar to this:

if (!-f $request_filename) {
break;
proxy_pass http://domain.com:81;
}

I’ve noticed that if this is used the url gets rewritten to
http://domain.com:81/file

Is there a way to have it not add in :81 into the url?

Thanks

John Quaglieri

On Fri, Feb 01, 2008 at 09:34:54AM -0500, John Quaglieri wrote:

I’ve noticed that if this is used the url gets rewritten to
http://domain.com:81/file

Is there a way to have it not add in :81 into the url?

Where do you see these URLs: inside HTML or redirects ?

It changes in the address bar, in the HTML they remain the same.

Thanks Igor. The proxy_redirect has solved this.

On Fri, Feb 01, 2008 at 10:00:15AM -0500, John Quaglieri wrote:

It changes in the address bar, in the HTML they remain the same.

It seems it’s redirect.
Are you sure you use domain.com:81 in proxy_pass, but not 127.0.0.1, etc
?

You may try

  if (!-f $request_filename) {
      break;
      proxy_pass  http://domain.com:81;
 }

 proxy_redirect  http://domain.com:81   http://domain.com;

Also the debug log will help.

On Fri, Feb 01, 2008 at 10:42:57AM -0500, John Quaglieri wrote:

Thanks Igor. The proxy_redirect has solved this.

nginx should do it by default if you set the same domain name in
proxy_pass, those backend returns in its redirect.