Forum Discussion
Kenny_Van_73892
Nimbostratus
Oct 24, 2006Help me with redirect and match cases, please
I just recently upgraded my Big IP units from version 4.5.10 to 4.6.4 to implement new features such as tolower() in irules. The upgrade went well, but when I tried to use tolower() and redirect in a irule, the web page failed to load up.
Let say I have a site calls https://www.secure.com/logon/default.aspx and here the irule for the site:
if (server_port == 80) {
if (tolower(http_uri contains "logon")) {
redirect to "https://%h/%u"
}
else {
discard
}
}
else {
discard
}
So, here my test: if I type https://www.secure.com/logon/default.aspx then the webpage loads properly, but if I type www.secure.com/logon/default.aspx or WWW.SECURE.COM/LOGON/DEFAULT.ASPX then the webpage just timeout with error message The page cannot be displayed. If I remove tolower(), then type www.secure.com/logon/default.aspx then the irule will redirect to https properly.
Is there anyway to have tolower() and redirect work together in the same irule? What did I do wrong in the irule above? Please help me out.
Thanks in advance.
- Martin_MachacekHistoric F5 AccountKenny,
if (tolower(http_uri) contains "logon") { redirect to "https://%h/%u" } else { discard }
redirect to "https://" + http_host + tolower(http_uri)
virtual 1.2.3.4:80 { use rule your_rule }
- Kenny_Van_73892
Nimbostratus
Well, I got a chance to test the matching cases irules yesterday. All worked well, except when I modified the above irules little bit, the use pool function never worked out right. - Kenny_Van_73892
Nimbostratus
Anyone has any idea, please help me out. Thanks. - You need to fix the tolower call. It should only have the http_uri as a parameter, instead you have the entire contains condition. This is returning a boolean and the tolower returns a non-zero value which is always interpreted as true so the initial if will always succeed.
if (tolower(http_uri) contains "logon") { redirect to "https://" + http_url + tolower(http_uri) } else { use pool my_pool }
- Kenny_Van_73892
Nimbostratus
Sorry my mistake. I actually had if (tolower(http_uri) contains "logon") {....
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