ngx_http_map_module

Igor Sysoev is at rambler-co.ru
Wed Nov 21 13:32:05 MSK 2007


On Wed, Nov 21, 2007 at 02:10:06AM -0800, Cliff Wells wrote:

> I saw this module mentioned on IRC and thought I'd give it a try.  
> 
> 
> http {
> 
>     map $http_host $backend {
>         hostnames;
>         default          http://127.0.0.1:8000;
>         .domain1.com     http://127.0.0.2:8000;
>         .domain2.com     http://127.0.0.3:8000;
>         # ...
>     }
> 
> 
>     server {
>         server_name     domain1.com www.domain1.com;
>         listen          198.145.247.210:80;
>         location / {
>             proxy_pass    $backend;
>             include       /etc/nginx/proxy.conf;
>         }
>     }
> 
> 
>     server {
>         server_name     domain2.com www.domain2.com;
>         listen          198.145.247.210:80;
>         location / {
>             proxy_pass    $backend;
>             include       /etc/nginx/proxy.conf;
>         }
>     }
> 
>     # ...
> }
> 
> 
> But this fails to load with "invalid URL prefix".  Is it not possible to
> use variables in proxy_pass directive or am I doing something else
> wrong?

Now proxy_pass does not support variables, however, it will be changed
in near future: async resolver and proxy_pass variables support are almost
ready and now in internal testing.


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





More information about the nginx mailing list