Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

iRule for disallow Request Content-Length in the header from being sent

Hello All,

I'm facing this issue "Request Content-Length differs from actual request body length"

Image Text I have contact with the dev team, they have a workaround to disallow this value in the header from being sent, can I do the same on the BIG-IP via iRule?

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

It's better if the dev team fix their code to send the correct content length value.

If that's not possible, you can disable the violation from your ASM blocking settings.

Removing the header via irule might trigger other violations.

But you can also recalculate the length in an iRule:

when HTTP_REQUEST {
    if { [HTTP::method] eq "POST" } {
        HTTP::collect
    }
}
when HTTP_REQUEST_DATA {
    HTTP::header replace Content-Length [HTTP::payload length]
}
0
Comments on this Answer
Comment made 6 days ago by Mohanad33 55

Thanks, Abdessamad

If i disable unparsable request content, sub-violations will be disabled too not just (Request Content-Length: "length" differs from actual request body length: "length")

https://support.f5.com/csp/article/K44162352

Please explain your iRule :) I'm a noobie

0
Comment made 6 days ago by Abdessamad 250

The irule will check if it's a POST request, collect the payload, calculate its size and then replace the content-length value.

0
Comment made 6 days ago by Abdessamad 250

The irule will check if it's a POST request, collect the payload, calculate its size and then replace the content-length value.

0
Comment made 6 days ago by Abdessamad 250

The irule will check if it's a POST request, collect the payload, calculate its size and then replace the content-length value.

0
Comment made 6 days ago by Abdessamad 250

The irule will check if it's a POST request, collect the payload, calculate its size and then replace the content-length value.

0
Comment made 6 days ago by Abdessamad 250

The irule will check if it's a POST request, collect the payload, calculate its size and then replace the content-length value.

0
Comment made 6 days ago by Mohanad33 55

Thanks, i will apply the iRule and feedback

0