Forum Discussion

johndegern_4568's avatar
johndegern_4568
Icon for Nimbostratus rankNimbostratus
Mar 29, 2010

How many redirects can I have in a single iRule?

I have a project where I would like to use BigIP to redirect 200+ domains to different domains. Sometimes to a host::uri.

 

 

How many "If Else" can one have in an iRule? Would a better approach be to have separate iRules for each redirection?

 

 

I am very interested in using a best practice approach for this device and definitely don't want to put any major stress to a bustling production system.

 

 

Thanks in advance to the guru community.

5 Replies

  • Hi John,

     

    if you are looking a 200 domains then my suggestion is to use class command http://devcentral.f5.com/wiki/default.aspx/iRules/class.html

     

     

    It's flexible enough to use when you large set of redirections.

     

     

    I hope this helps

     

    Bhattman

     

     

  • I probably should have specified the version in my first post. We're using BIG-IP 9.3.1 Build 37.1 and the link you provided is for v10.

     

     

    Anything else? Is it a big deal to do the redirects using if/elseif/elseif/elseif?

     

     

  • You could chain 200 if/elseif.../else together, but it would get a bit unwieldy. You could still use a datagroup in 9.3.1. But you'd use matchclass or findclass to search the class. ~200 lines shouldn't add a lot of overhead but it's always good to do performance testing if you can before using a rule like this in production. If the redirects are all of the same VIP, it would be best to combine the redirects in a single iRule. This helps you avoid attempting to send multiple redirects on the same request (which triggers a runtime TCL error).

     

     

    For details you can check the various wiki pages:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/matchclass

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/findclass

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/timing

     

     

    Aaron
  • Don't forget the SWITCH command (http://devcentral.f5.com/wiki/default.aspx/iRules/switch.html)

     

     

    Bhattman