28-Apr-2020 07:51
I have an iRule that is looking in the HTTP POST request method data payload for a string that is defined in a data-group. I would like to print to the log whichever string from the referenced data-group is found.
# See https://devcentral.f5.com/s/question/0D51T00006i7hpJSAQ/irule-to-block-requests-with-specific-word
#
# ltm data-group internal restricted_dg {
# records {
# restricted {}
# }
# type string
# }
when HTTP_REQUEST_DATA {
set payload [HTTP::payload]
if {[class match [string tolower $payload] contains "restricted_dg"]} {
# set variable named restricted_text to the string found in $payload
# that matches something in data-group restricted_dg
log local0. "Rejecting restricted content $restricted_text"
reject
}
}
28-Apr-2020 09:09
when HTTP_REQUEST_DATA {
set payload [HTTP::payload]
set value [class match -value [string tolower $payload] contains "restricted_dg"]
if {$value != ""} {
# set variable named restricted_text to the string found in $payload
# that matches something in data-group restricted_dg
log local0. "Rejecting restricted content $restricted_text :$value"
reject
}
}
28-Apr-2020 09:48
Thanks for your reply Pete.