Forum Discussion
breasoner_11658
Nimbostratus
Aug 16, 2010direct similar uris to their own pools via datagroup
Hi -
I have an iRule that was working just fine until I made a recent addition. The rule finds the uri and directs traffic to a pool based on the information contained in a datagroup:
when CLIENT_ACCEPTED {
set DATA_GROUP my_class
}
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
log local0.notice "Incoming Request: $uri"
set pool [class match -value $uri contains $DATA_GROUP]
if { $pool ne "" } {
log local0.notice "Directing to: $pool"
pool $pool
}
}
The datagroup looks like this:
clienta := Client-A-Pool
clientb := Client-B-Pool
The problem that I'm running into is we added a second site for clienta, in which the uri is clienta1. I added a line to the datagroup:
clienta1 := Client-A1-Pool
But it doesn't work. Anytime I go to http://mysite.com/clienta1, traffic gets directed to Client-A-Pool.
Anyone have any ideas on how I can make this work?
Thanks,
Brian.
- Chris_Miller
Altostratus
Since you're using "contains" instead of "equals," clienta1 matches the "clienta" datagroup line. - breasoner_11658
Nimbostratus
Thanks for the reply Chris. - Chris_Miller
Altostratus
Posted By breasoner on 08/16/2010 10:38 AM - The_Bhattman
Nimbostratus
Hi Breasoner, - breasoner_11658
Nimbostratus
Thanks Bhatmann. I'll check it out today and post back with any findings/progress. - hoolio
Cirrostratus
I think the datagroup order is arbitrary, particularly after config reloads, so I'm not sure manually ordering them would be a long term solution. Also, I don't think the class functions return the most specific match for string searches. You could get the full class back as a TCL list using 'class get' and then iterate through the list looking for the longest match. Deb did something similar for 9.x in this example: - hoolio
Cirrostratus
dupe
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