Srinivasan_G_31
Oct 25, 2012Nimbostratus
iRule help
Hi,
I want an iRule which can match a specific URI on an incoming http request and redirect traffic to a specific pool member of a pool. Please help.
Srini
[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 pool foo1 list
pool foo1 {
members 200.200.200.101:80 {}
}
[root@ve10:Active] config b pool foo2 list
pool foo2 {
members 200.200.200.111:80 {}
}
[root@ve10:Active] config b pool foo list
pool foo {
members 200.200.200.101:80 {}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
set path [HTTP::path]
switch -glob [HTTP::path] {
"*1234*" { pool foo1 }
"*5678*" { pool foo2 }
default { pool foo }
}
}
when HTTP_RESPONSE {
log local0. "[IP::client_addr]:[TCP::client_port] -> [clientside {IP::local_addr}]:[clientside {TCP::local_port}] -> [IP::remote_addr]:[TCP::remote_port] | [LB::server pool] | $path | [HTTP::status]"
}
}
[root@ve10:Active] config tail -f /var/log/ltm
Oct 28 09:18:37 local/tmm info tmm[7926]: Rule myrule : 172.28.20.11:59463 -> 172.28.19.79:80 -> 200.200.200.101:80 | foo1 | /1234.aspx | 404
Oct 28 09:18:39 local/tmm info tmm[7926]: Rule myrule : 172.28.20.11:59464 -> 172.28.19.79:80 -> 200.200.200.111:80 | foo2 | /5678.aspx | 404
Oct 28 09:18:43 local/tmm info tmm[7926]: Rule myrule : 172.28.20.11:59465 -> 172.28.19.79:80 -> 200.200.200.101:80 | foo | /something/index.html | 404