0

如何解决 400 The plain HTTP request was sent to HTTPS port 问题?

from: empValidation
to: myhost:443/EmpValidation/EmpValidationAPIService
 rules.getRules().forEach(x->{
        final LoadBalanceDefinition lb =  from("jetty:http://0.0.0.0:"+rules.getPort()+"/"+x.getFrom()+"??matchOnUriPrefix=true").log(LoggingLevel.DEBUG, "Processing ${id}").log("Incoming Context Request :"+x.getFrom())
        .loadBalance().roundRobin();
        x.getTo().forEach(z->lb.to("http4://"+z+"?bridgeEndpoint=true&throwExceptionOnFailure=true").log("Outgoing mapping urls :"+z)) ;
      });

如果我使用“https4”组件,它可以在上面的 url(empValidation) 上工作,但它不适用于下面的 url。

Url: myhost:9008/emp-web-service/services/addEmp

Error:
 javax.net.ssl.SSLHandshakeException: Remote host closed connection during 
 handshake
          at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
          at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
          at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
          at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
          at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:396)

我认为如果我们使用默认端口它不起作用,上述情况的解决方案是什么?

4

1 回答 1

0

好吧,这取决于端点是端点http还是https端点(使用服务器证书来加密客户端和服务器之间的流量)。无论在哪个端口号下发布。

  • 如果端点已https启用,您需要使用 URI,例如https4://hostname...
  • 如果端点是普通http端点,则需要使用 URI,例如http4://hostname...
于 2018-05-15T08:02:43.593 回答