Conor_Cunningha
Oct 07, 2008Nimbostratus
Replace Host on Original HTTP Request
Hi All,
I'm looking to do the following;
In the HTTP_Request, store the entire request in a variable called orgRequest
If I get a 302 redirect in the response I want to change the header "Host" to the IP address I received in the redirect.
I have a variable called newHost which has the IP address and port of where I want to go, what I don't know how to do is to replace the "Host" in the original request and resend. What I am currently seeing is that my output in /var/log/ltm shows my orgRequest with the original "Host" header.
Ideally I could do this by invoking the LB_Selected Event, but I don't know if you can invoke events - does anyone know if this is possible?
Basically what I have looks like this (semi-pseudo code)
HTTP_Request {
set orgRequest [HTTP::request]
}
HTTP_Response {
if 302 redirect
set newHost = Location Header of 302 response
set orgRequest $orgRequest[HTTP::header replace "Host" "$newHost"]
HTTP::retry $orgRequest
}
Cheers,
Conor