Hi Eliot,

On 04/10/2019 22:13, Elliot Barlas wrote:
Why is HttpClient behaving this way? Browsers certainly doin't do this. Am I missing a config option?

Thanks for reporting this. I believe this is a bug - I have logged
https://bugs.openjdk.java.net/browse/JDK-8232625

In the mean time - I'd suggest simply not setting any redirect
policy in the HttpClient, and handling the redirect directly from
your application code instead.

e.g. something like:

HttpResponse<String> resp = client.send(...);
if (resp.statusCode() == 303) {
    String location = resp.headers().firstValue("Location")
           .orElseThrows(....)
    resp = client.send(...)
}

best regards,

-- daniel

Reply via email to