Forum Discussion
Ube_34341
Nimbostratus
Nov 29, 2012Modify HTTP::collect header
Hi everybody,
I'm trying to duplicate an HTTP post to different destinations modifying headers before sending it. This is what I've been doing:
when HTTP_REQUEST {
HTTP::collect [HTT...
Ube_34341
Nimbostratus
Nov 29, 2012You 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]"
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects