Regarding using of nginx http load balancer
Roman Arutyunyan
arut at nginx.com
Tue Aug 5 11:54:17 UTC 2014
On 05 Aug 2014, at 15:11, Pankaj Kaushik <dev.panky2014 at gmail.com> wrote:
> Hey Roman,
>
> I do not actually get the idea how to use map in below scenario.
>
> Suppose i have two form of uri as mentioned below:-
>
> URI 1 : http://abc.10.23.32.22:2000/testFile
>
> URI 2 : http://10.20.32.23:2000/def/testFile
>
> So i want to fetch out following substring from above mentioned URI's as a key :-
>
> Key 1 : abc
>
> Key 2 : def
>
Here’s an example for the second case
map $uri $key2 {
~^(?<key>/[^/]+)/ $key;
default "";
}
Now you can use $key2 in the “hash” directive.
More information about the nginx-devel
mailing list