Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.

irule to look to see if the value is in the Body


I was trying to figure out how to write an iRule to look for a parameter in the Body. I thought the token would be in the header. However the developer put it in the body. How do I look in the body of a http req.


Thanks for your help.



  if { [HTTP::uri] equals "login.aspx" } {

    if { [HTTP::header exists "token"] } {

      log local0. "Request from [IP::client_addr] for login.aspx includes HTTP header token with value: [HTTP::header "token"]"

    } else {

      log local0. "Request from [IP::client_addr] for login.aspx does not include HTTP header token"






when HTTP_REQUEST { if {[HTTP::method] eq "POST"}{ if {[HTTP::header "Content-Length"] ne "" && [HTTP::header "Content-Length"] <= 1048576}{ set content_length [HTTP::header "Content-Length"] } else { set content_length 1048576 } if { $content_length > 0} { HTTP::collect $content_length } } } when HTTP_REQUEST_DATA { log local0. "Token = [findstr [HTTP::payload] "token=" 6 &]" }



This is the way, however I would be careful to implement it. I'd recommend to do performance testing before deploying it in a production environment.

Just recently I had a similar requirement and it works good with small requests. However the customer had POST requests up to 400kb. Then this suddenly becomes heavy on the CPU.