Forum Discussion
Shay_Ben-David1
Nimbostratus
Nov 01, 2006choos nodes according to cookie name and value ?
i need irule to choose between nodes (servers) according to the cookie comes in the http/https request, lets say if client came with cookie name: abc and value 1, it will go to server A, if it comes with cookie name: abc and value 2 it will go to server B ?
6 Replies
- hoolio
Cirrostratus
You can inspect the cookies a client presents with the HTTP::cookie commands. You can set a node for a specific request using the node command. You can check the respective wiki pages for HTTP::cookie (Click here) and node (Click here), or search the forums for examples. Repost here if you have any questions. - Shay_Ben-David1
Nimbostratus
thanks for the assist, but nothing here helps in this, i need irule example for track the client request and decide wich server to get the client according to the cookie name and value, here is an example of what i try, but i can't get it work, when i come to the vip it do load balancing eventhough i have irule on the vip. - hoolio
Cirrostratus
Hi,when HTTP_REQUEST { if { [HTTP::cookie exists "amlbcookie"] } { log local0. "[HTTP::cookie "amlbcookie"]" switch -glob [HTTP::cookie "amlbcookie"] { *01* { node 192.168.10.66 log local0. "matched 01" } *02* { node 192.168.10.67 log local0. "matched 02" } } } else { pool skyp-AM-1873 log local0. "default" } }
- unRuleY_95363Historic F5 AccountBTW, "switch" by default is an exact match. You need to add "-glob" to match with *'s.
- Shay_Ben-David1
Nimbostratus
thanks guys, seems to be better, but i didnt understand the log, there is two time "Default", should that be, because if he got a match, why using the pool ? - Colin_Walker_12Historic F5 AccountI would imagine that requests with no cookie, or at least with a cookie that doesn't have the value you're expecting, would log the "default" message.
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