Forum Discussion
James_Thomson
Employee
Dec 10, 2004mapclass2node
Along the same lines off an an earlier post by Natty about persistence. I'm trying to just read a cookie that is handed out by the server and persist a user on it. One example is where the cookie is s...
May 17, 2005
First a little on findclass and matchclass. matchclass will search a data group list for an exact string match while findclass will search for a string in the class that starts with the search string. Either should work for your case but I just wanted to make clear the subtle difference.
So, the answer to your question really depends on what you have defined in your data group list as well as in the cookie. If you have the cookie being set in the format of "xx ip_addr:port", then since you are including the port in the cookie, you will have to explicitly state all values in the data group list.
Another option would be to include only the IP Addresses in the data group list and use the getfield command to break apart the cookie value into address and port before searching.
// assuming $server is of the form "xx ip4_addr:port"
set server_addr [getfield $server ":" 1];
You might want to throw in some "[info exists var]" in there to make sure you don't get runtime errors on the assignment commands for undefined variables - check in the /var/log/ltm logfile for any signs of this. You'll get something like this if you try to reference an undefined variable
can't read "varaible_name": no such variable
Once that is done, you then can do a matchclass (or findclass) on the extracted addr
set entry [findclass $server_addr $::staging_nodes]
Hope this helps...
-Joe
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