Forum Discussion

Gullapudi_Venka's avatar
Gullapudi_Venka
Icon for Nimbostratus rankNimbostratus
Jun 30, 2016

Utilization of Data group in an iRule

I am trying to write an iRule that will reject the IP::Client_IP_addr if the HTTP_REQUEST had a certain cookie.

 

I placed the multiple cookie items in the data group named Cookie_datagroup.

 

when HTTP_REQUEST { if { [class match [HTTP::cookie] equals Cookie_datagroup] } { reject }

 

}

 

Can i please get help in getting this to work. I am not able to figure what is the mistake.

 

Thanks in advance.

 

1 Reply

  • Two options:

    when HTTP_REQUEST { 
        if { [class match [HTTP::cookie names] contains Cookie_datagroup] } { 
            reject 
        }
    }
    

    Alternate option:

    when HTTP_REQUEST {
        if { [HTTP::cookie exists "old-cookie-name"] } {
            reject
        }
    }