I did some more tests to test http::retry using the following rule. I tested the same request that failed on my original rule. From the logging, I see the first request always went through but the retry request always get a "Bad Request" response. I looked at the http::retry wiki page again and saw this - "Resends a request to a server. The request header must be well-formed and complete." So, I think that the original request's headers are likely the cause of the failure, although they looked fine to me. I just wonder why this command is strict on the request headers if all it supposed to do is resending a request.
when CLIENT_ACCEPTED {
set the flag to control lookup
set lookup 0
}
when HTTP_REQUEST {
save the original request for retry later
if { $lookup == 0 } {
set original_request [HTTP::request]
set original_payload [HTTP::payload]
log local0. "Original Request"
log local0. "Original Request = $original_request"
log local0. "Original Payload = $original_payload"
} else {
log local0. "Retry Request"
set retry_request [HTTP::request]
set retry_payload [HTTP::payload]
log local0. "Retry request = $retry_request"
log local0. "Retry payload = $retry_payload"
}
pool NEXTGEN_POOLA
}
when HTTP_RESPONSE {
collect first response (from lookup server) only
if { $lookup == 0} {
log local0. "Received First Response"
} else {
log local0. "Received Retry Response"
}
HTTP::collect 1
}
when HTTP_RESPONSE_DATA {
set payload [HTTP::payload]
if { $lookup == 0 } {
log local0. "First Response Payload = $payload"
retry the request again.
set lookup 1
pool NEXTGEN_POOLA
HTTP::retry $original_request
} else {
log local0. "Retry Response Payload = $payload"
}
}