iRule of HTTP::header insert with class match

I have an iRule set so: when HTTP_REQUEST { HTTP::header insert CLIENT_IP_ADDRESS [IP::client_addr] }

I need that when obtain the IP make a matchclass to validate whether this within the group, if this allows, if not this send a drop. How can I do this?

Try this:

when CLIENT_ACCEPTED {
    if { not ( [class match [IP::client_addr] equals my_allow_list] ) } {
        drop
    } 
}
when HTTP_REQUEST {
    HTTP::header insert CLIENT_IP_ADDRESS [IP::client_addr]
}

where “my_allow_list” is an address-based data group.