Forum Discussion
Thomas_89706
Nimbostratus
May 17, 2007In need of some iRule HELP!! URI Path stuff.
I'm trying to take the first path in the URI and direct it to a specific pool if it contains a specific string. For some reason my iRule below is directing all traffic to my catch all pool even if it meets the criteria set. Please help me I'm not sure what I'm doing wrong.
testing URL: "http://192.168.1.1/b02181/1.jsp"
jsp returns the machine name that it hits every time it goes to my pl_2 machine.
iRule:
when HTTP_REQUEST {
set CSID [string tolower [URI::path [HTTP::uri] 1 1]]
if { ([ $CSID] equals "b02181") or ( [$CSID] equals "h05527") } {
pool pl_1
} else {
pool pl_2
}
}
If my iRule has "/" in the beginning and end of the string compares it fails totally.
- Thomas_89706
Nimbostratus
Also will take any advise to having a list of CSIDs that it can check against like walk through an array and see if there is a string that matchs the CSID and then go to pl_1 if no match then go to pl_2. - JRahm
Admin
Remove the brackets around your variables for starters:if { ($CSID equals "b02181") or ($CSID equals "h05527") } {
- JRahm
Admin
You can build a class of your CSID's then reference your class for pool pl_1 inclusion:class myCSID { "b02181" "h05527" } when HTTP_REQUEST { set CSID [string tolower [URI::path [HTTP::uri] 1 1]] if { [matchclass $CSID equals $::myCSID] } { pool pl_1 } else { pool pl_2 } }
class myCSID { "b02181 pl_1" "h05527 pl_1" "x07770 pl_2" "y07070 pl_3" } when HTTP_REQUEST { set CSID [string tolower [URI::path [HTTP::uri] 1 1]] if { [matchclass $CSID equals $::myCSID] } { pool [findclass $CSID $::myCSID " "] } else { pool defaultPool } }
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