gpt4 book ai didi

spring-webflux - Spring Webflux。 WebClient代理身份验证和终结点SSL

转载 作者:行者123 更新时间:2023-12-03 14:55:07 27 4
gpt4 key购买 nike

我正在通过代理连接使用ssl服务测试webclient,但是使用安全ssl连接时出现以下错误。

你知道是什么问题吗?

堆栈跟踪:

{"timestamp":"2019-10-29T18:35:43.534+0000","path":"/football/areas","status":500,"error":"Internal Server Error","message":"failure when writing TLS control frames","requestId":"abfc15e 8","trace":"javax.net.ssl.SSLException: failure when writing TLS control frames\r\n\tat io.netty.handler.ssl.SslHandler.setHandshakeFailureTransportFailure(SslHandler.java:1807)\r\n\tSup pressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: \nError has been observed at the following site(s):\n\t|_ checkpoint Ôçó Request to GET https://api.football-data.org/ v2/areas [DefaultWebClient]\n\t|_ checkpoint Ôçó Handler com.jpc.controller.ResillenceController#getAreas() [DispatcherHandler]\n\t|_ checkpoint Ôçó HTTP GET \"/football/areas\" [Excepti onHandlingWebHandler]\nStack trace:\r\n\t\tat io.netty.handler.ssl.SslHandler.setHandshakeFailureTransportFailure(SslHandler.java:1807)\r\n\t\tat io.netty.handler.ssl.SslHandler.access$6 00(SslHandler.java:165)\r\n\t\tat io.netty.handler.ssl.SslHandler$2.operationComplete(SslHandler.java:942)\r\n\t\tat io.netty.handler.ssl.SslHandler$2.operationComplete(SslHandler.java:9 37)\r\n\t\tat io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)\r\n\t\tat io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:55 1)\r\n\t\tat io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)\r\n\t\tat io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)\r\n\t\t at io.netty.util.concurrent.DefaultPromise.setFailure0(DefaultPromise.java:608)\r\n\t\tat io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:117)\r\n\t\tat io.netty.c hannel.PendingWriteQueue.safeFail(PendingWriteQueue.java:285)\r\n\t\tat io.netty.channel.PendingWriteQueue.removeAndFailAll(PendingWriteQueue.java:181)\r\n\t\tat io.netty.handler.proxy.P roxyHandler.failPendingWrites(ProxyHandler.java:437)\r\n\t\tat io.netty.handler.proxy.ProxyHandler.failPendingWritesAndClose(ProxyHandler.java:354)\r\n\t\tat io.netty.handler.proxy.Proxy Handler.setConnectFailure(ProxyHandler.java:349)\r\n\t\tat io.netty.handler.proxy.ProxyHandler.channelRead(ProxyHandler.java:269)\r\n\t\tat io.netty.channel.AbstractChannelHandlerContext .invokeChannelRead(AbstractChannelHandlerContext.java:374)\r\n\t\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)\r\n\t\tat io .netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)\r\n\t\tat io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerConte xt.fireChannelRead(CombinedChannelDuplexHandler.java:438)\r\n\t\tat io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:328)\r\n\t\tat io.netty.handler.



Web客户端代码
public AreaServiceImpl(){

HttpClient httpClient = HttpClient.create().secure(sslContextSpec -> {
try {
sslContextSpec.sslContext(SslContextBuilder
.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.build());
} catch (SSLException e) {
e.printStackTrace();
}
})
.tcpConfiguration(tcpClient -> {
return tcpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS,8000)
.proxy(typeSpec -> {
typeSpec
.type(ProxyProvider.Proxy.HTTP)
.host("proxy")
.port(port)
.username("user")
.password(s -> "password").build();

});

});


ReactorClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);

//this.webClient = WebClient.create("https://api.football-data.org").;

this.webClient = WebClient.builder().clientConnector(connector).baseUrl("https://api.football-data.org").build();
}

最佳答案

虽然不是真正的解决方案,但是当无法从请求的计算机访问代理服务器,而在两者之间使用代理负载平衡器(HAProxy)时,却遇到了相同的错误。

关于spring-webflux - Spring Webflux。 WebClient代理身份验证和终结点SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58613882/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com