Variables and proxy_pass

Igor Sysoev is at rambler-co.ru
Mon Oct 2 17:24:33 MSD 2006


On Fri, 29 Sep 2006, Cliff Wells wrote:

> On Wed, 2006-09-27 at 15:48 -0400, Jonathan Dance wrote:
>
> There's been at least one other inquiry about using variables in proxy
> directives on the IRC channel:
>
>> how can I obtain a proxy pass rule like the following:
>>
>> proxy_pass http://localhost:7777/vhost/http/$host/;
>>
>> unfortunately $host is not substituted do I need to use rewrite rules
> first?
>
> I think this is a reasonable request... would it be difficult to
> implement?

I will add the variables support in the proxy_pass directive.

As to
     location  / {
         proxy_pass http://localhost:7777/vhost/http/$host/;
     }


the following workaround can be used:

     location  / {
         rewrite  ^(.*)$  /vhost/http/$host/$1  break;
         proxy_pass       http://localhost:7777;
     }


Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list