【发布时间】:2017-03-06 15:54:01
【问题描述】:
我一直在尝试使用 Apache Camel 的 Http4 组件连接到需要基本身份验证的 HTTPS URL。连接需要通过经过身份验证的 HTTP 代理来完成。
所以,根据docs,我这样配置Camel端点:
.toD("https4://target.host/resource?
bridgeEndpoint=true
&mapHttpMessageBody=false
&proxyAuthHost=my.proxy.host
&proxyAuthPort=myProxyPort
&proxyAuthUsername=proxyUser
&proxyAuthPassword=proxyPassword
&proxyAuthScheme=http4
&authenticationPreemptive=true
&authUsername=myUser
&authPassword=myPassword")
这会导致来自目标服务器的403 - Forbidden 响应。查看org.apache.http.wire 日志,它显示代理凭据 proxyUser / proxyPassword 被转发到目标服务器,而不是预期的 myUser/ myPassword 在Authorization 标头中。
调试CompositeHTTPConfigurer.configureHttpClient、ProxyHttpClientConfigurer.configureHttpClient 和BasicAuthenticationHttpClientConfigurer.configureHttpClient 的源,似乎因为两个配置器都通过setDefaultCredentialsProvider 将其凭据设置为HttpClientBuilder,因此其中一个丢失了-被覆盖-在这个过程中。
看起来这可能是 Camel 的 Http4 组件中的错误?还是我错过了什么?
这是带有 Spring Boot 1.5.1.RELEASE 的 Camel 2.18.2。
【问题讨论】:
标签: java apache-camel proxy-authentication camel-http