Forum Discussion
vidya_126776
Nimbostratus
Mar 05, 2013issue with irule script ???
This one works fine.
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/secure_one" } {
set replaceURI [string map [list /secure /wrap1] [HTTP::uri]]
HTTP::redirect ...
What_Lies_Bene1
Cirrostratus
Mar 05, 2013You seem to have too many braces in there with each if statement (two instead of one) and I would also suggest you put a line break between the last two as well. Note you could improve the rule by only having the first if and everything else being an elseif. Also, I'd say using the string operator would be far better than using this many if, elseif statements. This doesn't quite cover all your requirements but gives you the idea;
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/wrap*" -
"/seek*" -
"/one*" {
HTTP::redirect "http://www111.abc.com[HTTP::uri]"
}
"/secure_one*" -
"/seek_pond*" -
"/ask_wrap*" {
HTTP::redirect "$replaceURI"
}
}
}
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