regex matching on a cookie

Harish Sundararaj tuxtoti at
Mon Sep 3 15:34:25 UTC 2012


I have a URI like this:$IntegerA/$TermA


For this request , I might get cookies with names like

abc_cnv1, abc_cnv2, abc_cnv3....abc_cnv5

all or some of them. The value of these cookies are of the format:



Now this is the requirement:

If for any of the cookies in abc_cnv[1-5], $integerA equals $intergerB
choose an upstream based on $TermC.

I have figured out few of things:

1) Parsing $integerA - Using a regex in the location block
2) Choosing an upstream based on $TermC - using a map block

However, I'm stuck at reading cookies (not sure how to read only :
abc_cnv[1-5]). I understand it can be done using multiple ifs .
But I'm sure there should be a better way than that.

Any pointers?


More information about the nginx mailing list