简体   繁体   English

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

[英]How to configure Wildfly load balancing with redirect

I am working with wildfly undertow load balancer , and I added following configuration in standalone-load-balancer.xml but my request is not getting redirected?我正在使用 wildfly undertow 负载均衡器,并且在 standalone-load-balancer.xml 中添加了以下配置,但我的请求没有被重定向? I added reverse proxy handler and host to the Undertow subsystem as :我将反向代理处理程序和主机添加到 Undertow 子系统中:

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

And then I defined outbound socket bindings for remote hosts as :然后我将远程主机的出站套接字绑定定义为:

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

And then added the reverse proxy to a location as :然后将反向代理添加到一个位置:

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

The mistake I was doing here is , my load balancer was with ssl enabled and I was communicating with keycloak via 8443 which expecting load balancer and keycloak both with same certificates.我在这里做的错误是,我的负载均衡器启用了 ssl,我通过 8443 与 keycloak 通信,期望负载均衡器和 keycloak 都具有相同的证书。 So to get rid off this , I have connected to keycloak via 8080 port and I have enabled ssl only with load balancer .因此,为了摆脱这种情况,我通过 8080 端口连接到 keycloak,并且仅使用负载均衡器启用了 ssl。 So after changing below code it worked for me:因此,在更改以下代码后,它对我有用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM