iRule to check header length

Hi,

I have a customer that wishes to send larger queries to a different pool. He’s noticed the difference between queries can be decided by header length. He wants an iRule that picks up another pool if the header length is over 50k.

I’ve tried a couple of different iRules pulled from here and amended to no avail. I haven’t specified them as I’m looking for a fresh take on the problem.

Thanks in advance.

I assume you mean HTTP header? If so, is there a specific header?

Apologies I wasn’t clear it is the payload length that we wish to interrogate.

If the client sets a content-length header in the request you could check that with [HTTP::header Content-Length]:

when HTTP_REQUEST {
    Check if client is sending more than 500 bytes
   if { [HTTP::header Content-Length] > 500 }{
       Select big_pool
      pool big_pool
   } else {
      pool my_default_pool
   }
}

Aaron

Thanks, I’m not sure if that field is in there but I’ve stuck it on there to test.

For payload length maybe - http::payload length

All working thanks