For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Shumer_84688's avatar
Shumer_84688
Icon for Nimbostratus rankNimbostratus
Jun 27, 2013

iRule to calculate content-length of response using HTTP::collect and HTTP::payload

Here is a nice iRule to calculate content-length of response using HTTP::collect and HTTP::payload -

---- CUT BELOW ----
when HTTP_RESPONSE {
  log local0. "HTTP_RESPONSE triggered"
    HTTP::collect 32000000
    set length [HTTP::payload length]
HTTP::header insert "Content-Length" $length
  log local0. "the content length of the response from OWS is $length"
}
---- CUT ABOVE ----

PLEASE NOTE:

1) HTTP::collect may cause issues with Big-IP tmm when it is not limited to a specific size.

Please make sure you read this solution before setting this iRule : http://support.f5.com/kb/en-us/solutions/public/6000/500/sol6578.html

The iRule above is suitable to v11.x and above.

2) This is not an official F5 iRule. Use it at your own risk.

Shumer.

No RepliesBe the first to reply