Forum Discussion

mindo_152998's avatar
mindo_152998
Icon for Nimbostratus rankNimbostratus
May 06, 2014

Blocking a specific URL on a specific VIP with iRule

Hello All,

 

I am fairly new to creating iRules, and have been trying to create an iRule for an application we are load balancing. Basically what i am trying to do is block a certain URL on a VIP that contains "/Pages/manageusers.aspx", as seen below. After creating the Rule though, it doesnt seem to be doing anything. I was hoping that someone could take a look at it and let me know if i am doing anything wrong here.

 

Code when HTTP_REQUEST {
            if { ( ( [IP::addr [IP::local_addr] equals x.x.x.x] ) and  [string tolower [HTTP::uri]] contains "/Pages/manageusers.aspx" ) } {
                            log local0. "dropped"
                            reject
            }              
}

Thanks, Mindo

 

  • Looks like you're doing a lower case string match against a string with an upper case character, hence it will never match:

     

    [string tolower [HTTP::uri]] contains "/Pages/manageusers.aspx

     

    Try changing the upper case P in pages to lower case and see if that fixes your issue.

     

  • Looks like you're doing a lower case string match against a string with an upper case character, hence it will never match:

     

    [string tolower [HTTP::uri]] contains "/Pages/manageusers.aspx

     

    Try changing the upper case P in pages to lower case and see if that fixes your issue.

     

    • mindo_152998's avatar
      mindo_152998
      Icon for Nimbostratus rankNimbostratus
      Doh!, that make a lot of sense. It is working now after changing that, Thank you very much!