load-balancingkeycloakjboss-eap-7wildfly-12

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

Solution

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