configuration for proxy_pass/upstream combination

Maxim Dounin mdounin at mdounin.ru
Wed Jul 15 05:55:03 MSD 2009


Hello!

On Tue, Jul 14, 2009 at 05:01:31PM -0700, Mohammad Kolahdouzan wrote:

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

-     proxy_pass  http://server1;
+     proxy_pass  http://server1/;

See http://wiki.nginx.org/NginxHttpProxyModule#proxy_pass for 
details.

Maxim Dounin


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





More information about the nginx mailing list