Forum Discussion
Moe_Jartin
Cirrus
Jan 22, 2010How to match just / uri????
I have the following irule:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
/services* {
pool pool_beta-dev.blah.org_SERVICES
}
...
Moe_Jartin
Cirrus
Jan 25, 2010So 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:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
/services* {
pool pool_beta-dev.blah.org_SERVICES
}
.......
/ -
/\\?*
/main* -
/member* -
/legal* -
/manual* -
/platform* -
/resources* -
/search* {
pool pool_beta-dev.blah.org_SEARCH
}
.........
default {
HTTP::redirect http://beta-dev.blah.org/error/ui?code=404
}
}
}
Hope that helps someone.
One last question, why did I have to double escape the question mark?
Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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