URI Rewrite based on cookie value
Hey Devcentral,
I'm trying to come up with the best way to modify a URI based on a cookie value. I have control over the cookie value and would prefer to just do a simple string replace and replace part of the uri with whatever the value of the cookie is. I have some semi-psuedo code below that illustrates this a bit better.
The value of the cookie would be "-A2" or "A2" or something similar we could do an easy string replace on, this way if we decide to add A3 and A4 we don't need to update the Irule, just add the extra environments themselves.
What my question boils down to is: Is there a way to just set the cookie value to a variable and then reuse that in the irule script
http://abc.com to http://abc-a2.com
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "abc.com" } { HTTP::uri [string map -nocase {"abc.com" "abc-[cookievalue].com"} [HTTP::uri]] } }
Any help or guidance would be greatly appreciated.
Thanks, Beatty754