dathomas111_201
May 22, 2013Altocumulus
irule cookie insert
Hi,
I'm reaching out to the community in hope of getting irule assistance. I need to be able to create an irule that meets the following crtieria. As a plus it would be great to reference a string data group but I haven't been able to make that work. The VS is using a cookie type persistance profile.
The irule must...
1. Set a cookie value based on server IP (not server set cookie nor Bigip cookie)
2. Persist off of that cookie value
Here is what I have so far...
when HTTP_RESPONSE {
Insert cookie that matches the Web server IPs
if {[IP::server_addr] equals "10.0.0.1"} then {
HTTP::cookie insert name "webserver" value "wsA"
}
if {[IP::server_addr] equals "10.0.0.2"} then {
HTTP::cookie insert name "webserver" value "wsB"
}
if {[IP::server_addr] equals "10.0.0.3"} then {
HTTP::cookie insert name "webserver" value "wsC"
}
if {[IP::server_addr] equals "10.0.0.4"} then {
HTTP::cookie insert name "webserver" value "wsD"
}
if {[IP::server_addr] equals "10.0.0.5"} then {
HTTP::cookie insert name "webserver" value "wsE"
}
Persist off of that cookie value
if {{HTTP::cookie} equals "webserver"} then {
persist cookie
}
}
This seems to work but may be persisting off of the default cookie insert established in the "cookie" profile. (This was mandatory in order to use the "persist cookie" statement). Any and all help would be appreciated. Thanks.