Forum Discussion
iRule with Uppercase Letters in the URL
I am trying to force some letters in the URL to be uppercase. I have create the iRule but keep getting errors.
when HTTP_REQUEST { if { [HTTP::host] equals "test.xxxx.com" and [HTTP::uri] starts_with "/MyTest" } { pool pool_mytest.com--VIP247.100.TCP.443 } else { HTTP::redirect "https://test.xxx.com/MyTest/[HTTP::URI]" }
}
So what I need to do is, when anything called mytest comes in and in any format ie, mytest Mytest, mYtest, etc. I need to switch it to MyTest. Is that possible?
Thanks for any help in advance.
Matt
1 Reply
- Kevin_Stewart
Employee
Try this:
when HTTP_REQUEST { if { ( [string tolower [HTTP::host]] equals "x.x.com" ) and ( [string tolower [HTTP::uri]] starts_with "/mytest" ) } { if { not ( [HTTP::uri] starts_with "/MyTest" ) } { HTTP::uri [string map -nocase {"/mytest" "/MyTest"} [HTTP::uri]] } } else { HTTP::redirect "http://x.x.com/MyTest[HTTP::uri]" } }Better to not do the pooling in the iRule if you can help it, as the status of the monitor status of the assigned pool directly affects the status of the VIP.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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