Sekhar
Feb 20, 2015Nimbostratus
TCL 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 "||"...
Using 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.