Forum Discussion

jai_107202's avatar
jai_107202
Icon for Nimbostratus rankNimbostratus
Mar 26, 2014

irules to insert a text in header if a http request is coming in from a specific list of nodes in a data-group

we have a requirement to insert a text in the http header when a request is originating from a client node. the list of client nodes will be set as a data-group list and the incming request will check the client ip against a data-group list and if matches it will insert the text, if not it will send the request to the node as is. i am looking something like this....

 

when HTTP_REQUEST { if { (not [matchclass [IP::remote_addr] equals $::server_list]) and ([matchclass [string tolower [HTTP::uri]] contains $::access_control_uri]) insert "text"} { pool deny-pool } else { pool test-Pool }

 

is this possible? }

 

1 Reply

  • Hi!

    Try this one:

    when HTTP_REQUEST { 
        if { ![class match [IP::remote_addr] equals serverdatagrouplistname] and [class search acluridatagrouplistname contains [string tolower [HTTP::uri]]] } {
            HTTP::header insert "headername" "value"
            pool deny-pool
        } else { 
            pool test-Pool
        }
    }
    

    /Patrik