Kris__109062
Oct 31, 2008Nimbostratus
iRule to Select alternate pool member based on QUERY_STRING
Hi,
I have the following iRule setup (define_node) which allows me to force a pool member to be selected if I add ?node=01 , ?node=02 & ?node=03 to the query string..
Now the rule works and I am presented to the correct node but my problem is that subsequent requests do not persist if I take off ?node=01 from the QUERY_STRING
ie. http://intranet/?node=01 binds me to member 192.168.49.97 which is correct if you follow the irule logic below but subsequent requests eg. http://intranet/ might take me to other members in the pool.
How do I make it so that once ?node=01 is executed my persistence stays on that node ?
Irule (define_node)..
when HTTP_REQUEST {
set default_pool [LB::server pool]
set thenode [ findstr [string tolower [HTTP::uri]] "node=" 5 2]
if { $thenode == "01" } {
pool $default_pool member 192.168.49.97
}
if { $thenode == "02" } {
pool $default_pool member 192.168.49.98
}
if { $thenode == "03" } {
pool $default_pool member 192.168.49.99
}
}
virtual intranet_80 {
pool pool_intranetapp_80
destination 192.168.48.25:http
ip protocol tcp
vlans external_480 enable
rules
define_node
profiles
http
tcp
persist source3600
}
pool pool_intranetapp_80 {
lb method member observed
monitor all http_80
members
192.168.49.97:http
192.168.49.98:http
192.168.49.99:http
}
profile persist source3600 {
defaults from source_addr
mode source addr
timeout 3600
}