Routing traffic by URI using iRule
Published May 01, 2013
Version 1.0Was this article helpful?
So back then, I was rushed to come up with a solution, and I came up with my own 'proxy' iRule....
when HTTP_REQUEST priority 500 {
switch -glob [HTTP::uri] {
"/path1" -
"/path1/*" {
if { $usessl == 1 } {
set usepool pool1_ssl
} else {
set usepool pool1
}
}
"/path2" -
"/path2/*" {
...
}
}
Where there are another iRule with when HTTP_REQUEST with priorities before (set usessl and set usepool to [LB::server pool]), and after (check if [active_members $usepool] < 1) - display apology page, else pool $usepool).
Problem...you use string tolower on URI, but URI is case sensitive. (generally people are told to keep with lower case, but not everybody does, plus others with spaces.... Also some people do it intentionally, some with the intent that to hide/obscure private/internal only content (and getting the URI with case into robots.txt)....
Wonder if I need to worry about persistence or use catch, etc. since the temporary irule is starting to get old.... ;)