You are right; it is working. By the way I found why my application that lies upon this irule is not: as you can see in your tcpdump, the host is newhost forboth the destinations, but it should be different.
Here is the comple irule, with the different 2 Host Headers and 2 different Pools
when CLIENT_ACCEPTED {
set hsl [HSL::open -proto TCP -pool PoolB]
log local0. "[IP::client_addr]:[TCP::client_port]: New hsl: $hsl"
}
when HTTP_REQUEST {
HTTP::header replace host "HOSTA"
pool PoolA
set LogString "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri]"
log local0. "============================================= "
log local0. "$LogString (request)"
foreach aHeader [HTTP::header names] {
log local0. "$aHeader: [HTTP::header value $aHeader]"
}
log local0. "============================================="
HTTP::collect [HTTP::header Content-Length]
}
when HTTP_REQUEST_DATA {
set request_cmd "HTTP::request"
HTTP::header replace Host "HOSTB"
log local0. "[IP::client_addr]:[TCP::client_port]: Collected [HTTP::payload length] bytes, "
HSL::send $hsl "[eval $request_cmd][HTTP::payload]"
}