Forum Discussion
Mike_Young_6152
Nimbostratus
Jan 17, 2013iRule for selecting a pool based on a cookie value not working
I need to redirect traffic based on a cookie.
when HTTP_REQUEST {
if{([HTTP::cookie exists "asv"]) and ([HTTP::cookie value "asv"] eq "1" )}{
pool web_new_version_pool
} ...
nitass
Employee
Jan 17, 2013do you have tcpdump or log showing bigip sending traffic to wrong pool?
e.g.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
destination 172.28.19.252: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]
set cookie [HTTP::cookie value "asv"]
if { $cookie eq "1" } {
pool new_foo
} else {
pool foo
}
}
when HTTP_RESPONSE {
log local0. "client [IP::client_addr]:[TCP::client_port] | uri $uri | cookie $cookie | pool [LB::server pool] | server [IP::remote_addr]:[TCP::remote_port]"
}
}
[root@ve10:Active] config b pool foo list
pool foo {
min active members 1
members 200.200.200.101:80 {}
}
[root@ve10:Active] config b pool new_foo list
pool new_foo {
members 200.200.200.111:80 {}
}
[root@ve10:Active] config tail -f /var/log/ltm
Jan 18 04:11:56 local/tmm info tmm[4884]: Rule myrule : client 172.28.19.251:46804 | uri / | cookie 1 | pool new_foo | server 200.200.200.111:80
Jan 18 04:12:22 local/tmm info tmm[4884]: Rule myrule : client 172.28.19.251:46805 | uri /something | cookie 99 | pool foo | server 200.200.200.101:80
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects