如何使用重定向配置Wildfly负载平衡 [英] How to configure Wildfly load balancing with redirect

查看:333
本文介绍了如何使用重定向配置Wildfly负载平衡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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? I added reverse proxy handler and host to the Undertow subsystem as :

<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>

推荐答案

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

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. So to get rid off this , I have connected to keycloak via 8080 port and I have enabled ssl only with load balancer . 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>

这篇关于如何使用重定向配置Wildfly负载平衡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆