Forum Discussion

Sarvjit_81591's avatar
Sarvjit_81591
Icon for Nimbostratus rankNimbostratus
Jul 14, 2008

Programmatically select iRule

 

Is there any way to Programmatically select an existing iRule.

 

 

Assuming we have one iRule attached to a virtual server, I would like to (based on URI/host/whatever) select an existing iRule that is not attached to this particular virtual server.

 

 

Any help is appreciated.

 

 

Thanks

 

 

Sarvjit

3 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Right now there isn't a way to next iRules like this. The closest you could probably come right now is to set up a second virtual with the iRule enabled that you want to programmatically select, then select that virtual as a target in the case you want that iRule enabled.

     

     

    That is a pretty kludgey kludge, though, and would result in a bunch of nearly identical Virtuals, assuming you want to programmatically select more than one iRule.

     

     

    Colin
  • Thanks for the quick reply.

     

     

    How do you select the virtual server as the target? We are using 9.3.x, I know in 9.4 we have the option to use "virtual vsname".

     

     

    I assume we have to upgrade to 9.4....

     

     

    Thanks

     

     

    Sarvjit
  • There isn't a way in 9.3. You can only use the virtual command in 9.4 or higher.

     

     

    Rather than dynamically adding an iRule based on some tests, it would probably be cleaner to add the rule to the VIP and enable specific functionality based on the host, URI or other properties of the request.

     

     

    Aaron