Forum Discussion
Sekhar
Nimbostratus
Feb 20, 2015TCL Error
HI, I am seeing the following error in our LTM logs. Please help in spotting the error in irule.
Error:
TCL error: /Common/IR_abc_Redirect - can't use non-numeric string as operand of "||"...
cjunior
Nacreous
Feb 20, 2015Using the statement "If" would look like this:
if { [string tolower [HTTP::host]] equals "www.abc.com" or [string tolower [HTTP::host]] equals "abc.com" or [string tolower [HTTP::host]] equals "a.b.c.d" } {
HTTP::respond 301 Location "http://wp.abc.com/"
}
Replace the "if" statement by "switch", something like this:
switch [string tolower [HTTP::host]] {
"www.abc.com" -
"abc.com" -
"a.b.c.d" {
HTTP::respond 301 Location "http://wp.abc.com/"
}
}
https://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm
Hope this helps.
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