Not able to set response when using HTTP::Retry
I am trying to set up a simple Virtual Server in BigIP LTM that takes an HTTP request and sends it to all members in the pool assigned to it. My understanding is that HTTP:retry is, more or less, the only way to do so. I have written the following iRule
when RULE_INIT {
Log debug locally to /var/log/ltm? 1=yes, 0=no
set static::debug 1
}
when HTTP_REQUEST {
log local0. "Entering HTTP Request"
if { [HTTP::method] eq "GET"}{
set request_headers [HTTP::request]
if { $static::debug }{
log local0. "Saving HTTP request headers: $request_headers"
}
}
}
when HTTP_RESPONSE {
set response "Node request status"
set curr_node_ip [LB::server addr]
set curr_node_port [LB::server port]
set node_status [HTTP::status]
append response "$curr_node_ip:$curr_node_port$node_status"
foreach member_node [active_members -list [LB::server pool]] {
scan $member_node {%[^ ] %d} node_ip node_port
if { $node_ip == $curr_node_ip and $node_port == $curr_node_port }{
if { $static::debug }{
log local0. "Skipping already collected data for $node_ip:$node_port"
}
} else {
if { $static::debug }{
log local0. "Sending request to $node_ip:$node_port"
}
pool [LB::server pool] member $node_ip $node_port
HTTP::retry request_headers
set node_status [HTTP::status]
log local0. "$node_ip:$node_port sent answer $node_status"
append response "$node_ip:$node_port$node_status"
}
}
append response ""
log local0. "$response"
HTTP::respond 200 content $response "Content-Type" "text/html"
}
The problem is that I keep getting the following error when I run it
Illegal argument. Can't execute in the current context. (line 1) invoked from within "HTTP::respond 200 content $response "Content-Type" "text/html""
Not having the HTTP:Retry call gets rid of the error but ofc breaks the whole point of the rule. Not having the HTTP::respond seems to allow the rule to run with retry in place however the client connection hangs and gets no response
I am using BigIP 10.0.10.4
Most of my research shows that people have been doing the same thing and able to use HTTP::retry together with HTTP::respond in that way however I cannot understand why it does not work here.
Am I missing something?