Forum Discussion
Wes_98712
Nimbostratus
Apr 18, 2006mapclass2node
I have the following v4 rule within the pool as a node select expression:
V4 CODE:
mapclass2node(findstr(http_uri, "srv=", 4, '&'), urlaff_retailcf)
The class looks as follows:
V4 CODE:
class urlaff_retailcf {
"srv2 10.34.238.31:80"
"srv3 10.34.238.26:80"
}
What I need to know is how would I handle this in v9? Something as follows?
when HTTP_REQUEST {
set my_uri [HTTP::uri]
set my_query [HTTP::query]
if {[HTTP::host] equals "www.somehost.com"} {
set my_findstr [findstr $my_uri "srv=" "&", 4]
node [findclass $my_findstr $::urlaff_retailcf " "]
}
}
I'm thinking that would work, but not sure of the syntax, if someone could proof it that would be great. For this legacy cold fusion site we have to persist based on the URI query looking for srv= which then maps back to a specific server, referenced in the class.
Thanks,
-wn
- You are pretty darn close. The only thing I see that is sticking out is that you have the findstr arguments in the wrong place. The skip count of 4 should be before the termination character and you have a comma in there that would also cause a load error.
when HTTP_REQUEST { if {[HTTP::host] equals "www.somehost.com"} { set my_findstr [findstr [HTTP::uri] "srv=" 4 "&"] if { [string length $my_findstr] > 0 } { set new_node [findclass $my_findstr $::urlaff_retailcf " "] if { [string length $new_node] > 0 } { node $new_node } } } }
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