Forum Discussion
FishNiX_29746
Jan 26, 2010Nimbostratus
Thanks for your replies!
I hadn't really thought about it being the longest match...
I've been thinking about it as the most exact match of the first two entries in the class. Both HTTP::host and HTTP::uri need to match "the most" and if I ensure it ends with a "/" it will always work (as long as we never try to match /foo/foo.jsp I suppose).... maybe "longest" is the more correct way.
We are running 9.x. I don't really want the longest URL, I think I want the longest matching URI for whatver host is being requested....
What about something like this:
rule set_pool_by_host_and_uri {
when HTTP_REQUEST {
Class order isn't guaranteed to come back in the order entered in the bigip.conf...
log local0. "list: $::host_uri_pool_selector_class"
log local0. "lsort: [lsort -decreasing -index 0 $::host_uri_pool_selector_class]"
foreach row [lsort -decreasing -index 1 $::host_uri_pool_selector_class] {
log local0. "\$row: $row"
if { [string tolower [HTTP::host]] equals [getfield $row " " 1] }{
if { [string tolower [HTTP::uri]] starts_with [getfield $row " " 2] }{
pool [getfield $row " " 3]
break
}
}
}
}
}