Forum Discussion

Philip_L's avatar
Philip_L
Icon for Nimbostratus rankNimbostratus
Jul 16, 2012

Add iRule to all VIPs?

Hi All, Im having an issue with Baiduspider and I would like to block them.

I have created the following irule:

 

when HTTP_REQUEST { if { [HTTP::header "User-Agent"] contains "Baiduspider" } { drop return } }

 

 

 

However I need to add it to 300 different vips. Is it possible to do this through tmsh? I tried modify but from what I understand that will remove all current irules on that vip.

 

3 Replies

  • Hi Philip,

     

     

    Which LTM version are you running? I think you'll need to write a tmsh script which only attempts to add the iRule to virtual servers with an HTTP profile.

     

     

    You could start with Jason's config search example to get a list of virtual servers with an HTTP profile:

     

     

    https://devcentral.f5.com/wiki/tmsh.codeshare.ashx -> https://devcentral.f5.com/wiki/TMSH.ConfigSearch.ashx

     

     

    Aaron
  • Hi Aaron,

     

    My mistake. I am running 11.1. I was hoping it was a onw line command which already existed on the file system. I might just modify this:https://devcentral.f5.com/wiki/TMSH.RemoveIRuleFromMultipleVS.ashx to add the irule. Thanks for your reply
  • B_Earp's avatar
    B_Earp
    Icon for Nimbostratus rankNimbostratus

    I'm running 11.6 now and still no update to this. I ended up using the F5 iRule editor - you right click the iRule and select Properties - you can then select or deselect the VS that are using the iRule.