HTTP request cloning
Problem this snippet solves: These iRules send a copy of HTTP request headers and payloads to one or more pool members
These are the current iRule versions of the example from Colin's article. Co...
Published Mar 18, 2015
Version 1.0hooleylist
Cirrostratus
Joined September 08, 2005
hooleylist
Cirrostratus
Joined September 08, 2005
shaggy
Mar 20, 2018Nimbostratus
12.1.2 - HTTP::request in HTTP_REQUEST_DATA triggers "command is not valid in the current scope" when saving the iRule. I haven't tested, but creating a variable in HTTP_REQUEST and referencing it in the HTTP_REQUEST_DATA event should do the trick:
when HTTP_REQUEST {
...
set req_headers [HTTP::request]
}
when HTTP_REQUEST_DATA {
for {set i 0}{$i < $static::pool_count}{incr i}{
if {$static::clone_debug}{
log local0. "[IP::client_addr]:[TCP::client_port]: Collected [HTTP::payload length] bytes,\
sending [expr {[string length $req_headers] + [HTTP::payload length]}] bytes total\
to $static::clone_pools($i), request: $req_headers[HTTP::payload]"}
HSL::send $hsl($i) "$req_headers[HTTP::payload]\n"
}
}