Forum Discussion
Kalyan_Reddy_Da
Nimbostratus
Jul 20, 2010Irule with if-elseif to change to Switch-glob
Irule with if-elseif to change to Switch-glob
Please help me if anyone know how to change this if-else-if irule to switch-glob.
when HTTP_REQUEST {
if {([HTT...
hoolio
Cirrostratus
Jul 20, 2010Hi Kalyan,
A switch statement can only be used to check one string against a number of changes. If you wanted to check the requested URI for several different possible values, you could use a switch statement. It cannot be use to check multiple strings for multiple cases. So the current if/elseif/.../else syntax you're using is the best option.
For details on the switch statement, you can check the DC and TCL wikis:
http://devcentral.f5.com/wiki/default.aspx/iRules/switch
http://www.tcl.tk/man/tcl8.4/TclCmd/switch.htm
Aaron