Notice the match for just forward slash (/) going to the SEARCH pool. I can not get any request for just / to go to that pool. They just hit the default at the bottom and get redirected to the error page. Is there some secret to matchig just forward slash? Strange thing is, I have a nearly identical irule on another LTM and it matches on just / fine. HELP!!???!!!
I’m not sure quotes will make a difference for switch cases:
% switch / {
a { puts “matched A” }
b { puts “matched B” }
/ { puts “matched slash” }
default { puts “no match” }
}
matched slash
Can you add logging to the rule and see which case is actually being matched? If the match is made correctly, but the wrong pool is used, can you add a OneConnect profile to the VIP and retest? For details on this, you can check this page:
So after turning on some logging and looking at the HTTP headers in the browser i discovered that it actually WAS matching on just the “/” but then the server was redirecting with some params so it was trying to go to /?lang=eng, which of course was NOT being matched by just /. So I had to add another match string for “/?*”. Of course the ? is a regex special character so I had to escape it, so then it looked like “/\?*” but that wasn’t matching for some reason either. After a bit of digging I found that I had to double escape the ? for some reason??? So the final match strings looks like:
Thanks for your help!! For whatever reason it would not match on the single backslash and unfortunately I would probably get slapped around if I dink with the VIP again today. I will look at it again tomorrow and try some additional logging. What is the difference between HTTP::uri and HTTP::path? Seem to be the same except with HTTP::path I can actually alter the path rather than just query it.
HTTP::uri returns the full URI (/path/to/file.ext?param=value) and HTTP::path returns just the path (/path/to/file.ext). For a URI of /?param=value, HTTP::path would return just /.
I think you’d need to do some testing to find that out for your particular rules/applications. You can use the timing command to check the average CPU cycles per event: http://devcentral.f5.com/wiki/default.aspx/iRules/timing
I don’t know the inner workings for the two commands, but I’d guess that HTTP::path requires at least one more operation than HTTP::uri to parse the path from the URI. If you’re checking to see if the path or URI starts with a string, I’d guess HTTP::path and HTTP::uri would take close to the same CPU cycles to do the evaluation (with HTTP::path taking just a bit more CPU time to do the extra operation). If you’re doing a “contains” comparison with a URI that contains a query string, then the shorter comparison HTTP::path should be more efficient.