Question

I'm using Apache HttpClient 3.x for contacting a Big IP that will then redirect my request to one of 1-N machines. We have the need to know which of the N machines actually picked up the request though, and I'm not sure how to get this information. I looked through the Response headers with no luck, so I'm wondering if this information is actually provided anywhere? Is there a helper/utility class I can use to get any additional metadata?

Thanks.

Was it helpful?

Solution

If the request is redirected and you need the new location, you need to setFollowRedirects(false) on the method and handle the redirect yourself.

After sending the request, check getStatusCode() for 302 and getResponseHeader("Location") for the new address. Than change the address by setURI() and send again.

OTHER TIPS

Or you could just use mod_headers and insert a unique Header ID on each one of your Apache httpd servers ;-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top