Proxy with URI and params

António P. P. Almeida appa at perusio.net
Mon Jan 16 20:06:14 UTC 2012


On 16 Jan 2012 19h56 WET, robsonpeixoto at gmail.com wrote:

> Hi,
>
> I need to make a proxy solution. But I having some problems.
>
> When the type www.example.com/delivery/a/b/c I need to make a proxy
> to www.proxy.com/delivery/a/b/c/?var1=A&var2=B
>
> So a did this configuration
>
> location /delivery {
> subs_filter http://www.example.com/$uri
> http://www.proxy.com/$uri/?var1=A&var2=B;
> proxy_pass http://www.proxy.com/$uri/?var1=A&var2=B;
> }
>
> Why it not working ?

Because the HTTPSubModule replaces something on the *request body* not
on the configuration.

I suppose you want something like this:

server {
   server_name www.example.com;

   location /delivery {
       proxy_pass http://www.proxy.com$uri/?var1=A&var2=B;     
   }       
}

$uri already starts with a '/'.

--- appa



More information about the nginx mailing list