Forum Discussion

refra_151287's avatar
May 22, 2017

iRule: HTTP_REQUEST_DATA not triggered

Hello, We have an iRule, we're working on iRule, it was working but we wanted to enhance it, but we found that "HTTP_REQUEST_DATA" is not triggered when we initiate HTTP request with "GET" method....

the below is the iRule, any reason why "HTTP_REQUEST_DATA" is not triggered!

when HTTP_REQUEST {
if { [HTTP::method] eq "HEAD" or [HTTP::method] eq "POST" or [HTTP::method] eq "GET" or [HTTP::method] eq "PUT" or [HTTP::method] eq "DELETE" or [HTTP::method] eq "OPTIONS" or [HTTP::method] eq "PATCH" or [HTTP::method] eq "TRACE" or [HTTP::method] eq "CONNECT"}{
  HTTP::collect 20
  [HTTP::header Content-Length]
  log local0.  "CONNECT == [HTTP::header Content-Length]"
}
}
when HTTP_REQUEST_DATA {
  set payload [HTTP::payload]
   log local0.  "CONNECT [HTTP::payload]"
  if { [HTTP::payload 200] contains "ATTACK" and ([HTTP::method] eq "HEAD" or [HTTP::method] eq "POST" or [HTTP::method] eq "GET" or [HTTP::method] eq "PUT" or [HTTP::method] eq "DELETE" or [HTTP::method] eq "OPTIONS" or [HTTP::method] eq "PATCH" or [HTTP::method] eq "TRACE" or [HTTP::method] eq "CONNECT") } {
  log local0. "PAYLOAD CONTAINS CONNECT [HTTP::payload 200]"
    reject
}
  HTTP::release
}

1 Reply

  • Hi,

     

    In standard HTTP GET method, there is nothing to collect as there is no DATA after headers.

     

    POST and PUT method may raise HTTP_REQUEST_DATA event.