Forum Discussion
KD_48848
Nimbostratus
Aug 10, 2007URL convertion from upper case to lower case
We are currently having many redirect rules in place for one of our clients. The issue is that while redirecting we are giving conditions to match upper and lower case.
Is there any way that we can convert the URL in the first place itself.
For eg: We need to redirect http://www.abc.com/xyz to http://www.abc.com/pqr
Following redirect rule is in place:
=======
http_uri ends_with "/xyz" or http_uri ends_with "/XYZ") {
redirect to "http://www.abc.com/pqr"
}
=======
This works fine, but is there any way that we can just mention the lowercase condition and if any user hits the URL in uppercase, then it gets converted to lower case first and then matched with the above rule.
To achieve:
=======
User Enter : "http://www.abc.com/xyz" or "http://www.abc.com/xyz"
It gets converted to : "http://www.abc.com/xyz"
Then it is matched with the redirect rule :
http_uri ends_with "/xyz") {
redirect to "http://www.abc.com/pqr"
}
=======
Please any one who is aware or has worked on similar issue, advice on what is to be done.
Thanks,
KD.
- Deb_Allen_18Historic F5 AccountSure, the "tolower" function is what you need.
if (tolower(http_uri) ends_with "/xyz") { redirect to http://www.abc.com/pqr }
- KD_48848
Nimbostratus
Thanks deb. - Deb_Allen_18Historic F5 AccountWell, you're only testing the URI value, not the host header value, so it won't matter what case is used for the hostname.
if (tolower(http_uri) ends_with "/xyz" and tolower(http_host) equals "www.abc.com") { redirect to http://www.abc.com/pqr }
- KD_48848
Nimbostratus
Cool. - KD_48848
Nimbostratus
Hi, - KD_48848
Nimbostratus
Gonna try adding up the the parenthesis tonight. - KD_48848
Nimbostratus
Also can some one confirm if we can use lc() for lower case conversion in BigIPv4.5.10 ? - Deb_Allen_18Historic F5 AccountYou can use the tolower function like this:
((tolower(http_host) == "www.abc.com") and (tolower(http_uri) ends_with "/ghi"))
- KD_48848
Nimbostratus
Deb that work in 4.6.x and above and we are using 4.5.X - Deb_Allen_18Historic F5 Accountoops, sorry, I keep forgetting that...
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