Forum Discussion
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 "||" while executing "if { [string tolower [HTTP::host]] equals "www.abc.com" or "abc.com" or "a.b.c.d" } { HTTP::respond 301 Location ""
irule: when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "www.abc.com" or "abc.com" or "a.b.c.d" } { HTTP::respond 301 Location "http://wp.abc.com/" } }
Thanks,
Sekhar
1 Reply
- cjunior
Nacreous
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.
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