configuration for proxy_pass/upstream combination

Mohammad Kolahdouzan mohammad_ysm at yahoo.com
Wed Jul 15 04:01:31 MSD 2009


I have my own module in which when a request is sent to
/mymodule, it'll initiate a new
subrequest to "/a1" and passes a bunch of new arguments to it. As an
example, a call to "http://localhost/mymodule" will generate a
subrequest like "http://a.com/?x=1&y=2"
I have a config similar to the following to support that :

server {
  location /mymodule {
    my_module;
  }
  location /a1 {
    proxy_pass  http://a.com/;
  }
}


Now the issue that I have is when I want to add redundancy. If I change the config file to something similar to the following:

upstream server1{
  server http://a.com;
  server http://b.com;
}
server {
  location /mymodule {
    my_module;
  }
  location /a1 {
    proxy_pass  http://server1;
  }
}

then a request to "http://localhost/mymodule" will generate a subrequest like "http://a.com/a1/?x=1&y=1". I am wondering what it is that I am doing wrong which adds "/a1/" to the subrequest to upstream.

Thanks,
-M


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


More information about the nginx mailing list