16-Jun-2020 00:20
Hello,
I need to implement in F5 is a possibility to reject an HTTP request in case the size of the request is not corresponding to the Content-Length of the header.
I cannot use ASM for it.
I think use an irule like below where I can find a way to replace "set req [HTTP::request]" by a condition who indicate the size of the request in bit.
when HTTP_REQUEST {
set req [HTTP::request]
set len [HTTP::header "Content-Length"]
if { [expr $len eq ne expr $lreq} {
reject
}
}
}
Thanks in advance for your help.
20-Jun-2020 19:22
what you are trying to do will work with GET but you may wish to consider POST, where you will have to use HTTP::collect and use HTTP::payload length.
For use with GET, you can simply use string length:
when HTTP_REQUEST {
if { [expr { [string length [HTTP::request]] eq ne expr [HTTP::header "Content-Length"]} {
reject
}
}