Making a note of this because NetScalers at just awful at anything when it comes to messing with HTTP header cookie values.
So I wish to update the value of a Cookie
key of mykey=
to mykey=new_value
. I can do so with the following rewrite action:
-
Type:
REPLACE
-
Expression to choose target location:
HTTP.REQ.HEADER("Cookie")
-
Expression:
(HTTP.REQ.HEADER("Cookie").BEFORE_STR("; mykey=") + ("; " + HTTP.REQ.HEADER("Cookie")).AFTER_REGEX(re#; mykey=[^;]*#) + "; mykey=new_value").STRIP_START_CHARS("; ")
This will replace a key at the start, middle or end of a cookie string.
Painful? Yes. Useful? Somewhat.