Hello Cloudflare community,
I was doing a research for a while and not able to reach solution, would like to know how this part for this following rule actually works, I am trying to convert it to HAProxy LUA rule but not able to achieve any results, tried different solutions but same result without any success, any help or explanation for the headers calculations part is really appreciated.
(http.request.method eq “GET” and http.request.version eq “HTTP/1.1” and any(len(http.request.headers.values[])[] gt 45))
here is a part for the CF rule
any(len(http.request.headers.values[])[] gt 130))
my LUA code below
function check_headers(txn)
local headers = txn.http:req_get_headers()
local too_many_headers = false
table.foreachi(headers, function(_, header_value)
if #header_value > 130 then
too_many_headers = true
return
end
end)
if too_many_headers then
txn:set_var('txn.too_many_headers', true)
end
end
core.register_action('check_headers', {'http-req'}, check_headers)