Forum Discussion
nitass
Aug 25, 2012Employee
this is my testing.
additionally, have you seen this one?
sol9800: Using an iRule to load balance HTTP requests to multiple pools
http://support.f5.com/kb/en-us/solutions/public/9000/800/sol9800.html
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set uri [HTTP::uri]
switch -glob -- [string tolower $uri] {
"/con1/con2*" -
"/con2*" {
pool pool-2
}
"/con1*" {
pool pool-1
}
}
}
when SERVER_CONNECTED {
log local0. "URI $uri | Pool [LB::server pool] | [IP::client_addr]:[TCP::client_port] -> [clientside {IP::local_addr}]:[clientside {TCP::local_port}] | [IP::local_addr]:[TCP::local_port] -> [IP::server_addr]:[TCP::server_port]"
}
}
[root@ve10:Active] config b pool pool-1 list
pool pool-1 {
members 200.200.200.101:80 {}
}
[root@ve10:Active] config b pool pool-2 list
pool pool-2 {
members 200.200.200.102:80 {}
}
[root@ve10:Active] config cat /var/log/ltm
Aug 25 14:56:03 local/tmm info tmm[14353]: Rule myrule : URI /con1 | Pool pool-1 | 172.28.19.80:33020 -> 172.28.19.79:80 | 200.200.200.10:33020 -> 200.200.200.101:80
Aug 25 14:56:07 local/tmm info tmm[14353]: Rule myrule : URI /con1/something | Pool pool-1 | 172.28.19.80:33021 -> 172.28.19.79:80 | 200.200.200.10:33021 -> 200.200.200.101:80
Aug 25 14:56:16 local/tmm info tmm[14353]: Rule myrule : URI /con2 | Pool pool-2 | 172.28.19.80:33022 -> 172.28.19.79:80 | 200.200.200.10:33022 -> 200.200.200.102:80
Aug 25 14:56:26 local/tmm info tmm[14353]: Rule myrule : URI /con2/something | Pool pool-2 | 172.28.19.80:33023 -> 172.28.19.79:80 | 200.200.200.10:33023 -> 200.200.200.102:80
Aug 25 14:56:44 local/tmm info tmm[14353]: Rule myrule : URI /con1/con2 | Pool pool-2 | 172.28.19.80:33024 -> 172.28.19.79:80 | 200.200.200.10:33024 -> 200.200.200.102:80
Aug 25 14:56:53 local/tmm info tmm[14353]: Rule myrule : URI /con1/con2/something | Pool pool-2 | 172.28.19.80:33025 -> 172.28.19.79:80 | 200.200.200.10:33025 -> 200.200.200.102:80
hope this helps.