amebiz_142234
May 25, 2018Nimbostratus
irule pool selection based on dynamic cookie value
Hi, my scenario: i want to select a pool based on a cookie value - that works as aspected
when_HTTP_REQUEST {
if { [HTTP::cookie exists "myCookie"] } {
switch -glob [HTTP::cookie value "myCookie"] {
"foo" { pool foo }
"bar" { pool bar }
default { pool default }
}
} else {
pool default
}
}
i'm struggle at the point to set the cookie for a uri match condition
when_HTTP_REQUEST {
if { [string tolower [HTTP::uri]] equals "/foo/" } {
psuedo code: set cookie myCookie value foo
}
if { [string tolower [HTTP::uri]] equals "/bar/" } {
psuedo code: set cookie myCookie value bar
}
}
i know that i have to put the cookie insert in the HTTP_RESPONSE so that the browser add it but in this context is a uri match no possible have anyone a idea how i can set a cookie in the response with a condition in the request? thanks for your ideas