Our main problem is that RestTemplate has a default redirect status of FOLLOW_WHEN_POSSIBLE. When we build RestTemplateBuilder and want to use Apache HttpComponents as a basis, for some reason we check httpClientOptions for HttpClientOption.ENABLE_REDIRECTS, otherwise we set it to false, which is wrong.

The solution to this problem I saw was to set builder.redirects(Redirects.FOLLOW_WHEN_POSSIBLE); the default if (httpClientOptions != null).

Closes: #43431

Comment From: snicoll

@panic thanks for the PR but it contains unrelated changes. Looking at the actual change, fixing #43431 is going to require more work (testing, and reviewing the consistency).