Spring 6 RestTemplate Proxy Settings with HttpClient 5
The configured route and account matter only when the failing RestTemplate uses their matching request factory.
Follow the active client instance backward: RestTemplate → request factory → underlying HTTP client → proxy route/account. A configured helper beside another injected bean does not change that bean's calls.
The construction sequence is:
- Set the underlying client's proxy route and endpoint-scoped credentials.
- Give that client to the compatible HTTP-components request factory.
- Use that factory in the RestTemplate performing the operation.
Spring Framework 6's factory requires Apache HttpComponents 5.1 or later. HttpClient 4 builders, credentials and constructors belong to another generation. A factory-construction error precedes the later network/authentication path represented by 407.
A generic request interceptor adding Proxy-Authorization can miss the earlier HTTPS CONNECT exchange. Keep proxy and destination accounts on their respective supported transport/auth interfaces, and retain TLS verification.
For a report, keep Spring/client generation, active bean/factory, proxy and final error stage without secrets.