如何使用重定向配置 Wildfly 负载平衡

How to configure Wildfly load balancing with redirect

我正在使用 wildfly undertow 负载均衡器,我在 standalone-load-balancer.xml 中添加了以下配置,但我的请求没有被重定向? 我将反向代理处理程序和主机添加到 Undertow 子系统中:

<handlers>
       <reverse-proxy name="keycloak-handler">
       <host name="keycloak-host" outbound-socket-binding="remote-host" path="/auth"/>
      </reverse-proxy>
 </handlers>

然后我将远程主机的出站套接字绑定定义为:

 <outbound-socket-binding name="remote-host">
            <remote-destination host="192.168.1.5" port="8443"/>
 </outbound-socket-binding>

然后将反向代理添加到如下位置:

<host name="default-host">
    <location name="/auth" handler="keycloak-handler"/>
     <filter-ref name="load-balancer"/>
</host>

我在这里犯的错误是,我的负载均衡器启用了 ssl,我通过 8443 与 keycloak 通信,期望负载均衡器和 keycloak 都具有相同的证书。所以为了摆脱这个,我已经通过 8080 端口连接到 keycloak,并且我只使用负载平衡器启用了 ssl。因此,在更改以下代码后,它对我有用:

<outbound-socket-binding name="remote-host">
            <remote-destination host="192.168.1.5" port="8080"/>
 </outbound-socket-binding>