choosing backend based on header value

Harish Sundararaj tuxtoti at gmail.com
Mon Sep 3 23:44:57 UTC 2012


Hi,
Something that I could now quickly think of is. (thought not sure if it'll work)

>
> map $http_x_caching_node $x {
>     default  backend_boxes;
>     192.168.1.50:9001  192.168.1.50:9001;
> }
>
Changing the map block to:

map $http_x_caching_node $x {
default backend_boxes;
~^(\d.*) $1;
}

Maybe there is a better way.

Thanks
Harish

> server {
>     location /test/ {
>         proxy_pass http://$x;
>     }
> }
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list