1 Reply Latest reply on Jul 21, 2017 10:05 AM by Nicolas Ramos

    Connecting apache and Widfly using mod_cluster

    Ammar Al-Batool Newbie

      I am trying to setup mod_cluster as a reverse proxy for Wildfly 9. When I use http as a protocol (between mod_cluster and Wildfly), everything works just fine (forwarding requests to application server and detecting server).



      My problems come up when I try to wire mod_cluster and wildfly using ajp as a protocol. I checked mod_cluster-manager and it seemed that

      mod_cluster was connected to wildfly, but it couldn't forward

      requests to application server.



      I have the following configuration:



      - http server: Apache/2.4.18 (Ubuntu)

      - application server: Wildfly 9.0.2

      - mod_cluster: 1.3





          PersistSlots on

          CreateBalancers 1

          MemManagerFile /opt/mod_cluster/logs




          AllowDisplay On

          AllowCmd On

          WaitForRemove 1




          UseAlias 1

          ServerAdvertise Off


          Listen *:5555

          <VirtualHost *:5555>

              <Directory />

                  Order deny,allow

                  Allow from

                  Allow from

                  Allow from 127

                  Require all granted


               <Location /mcm>

                   SetHandler mod_cluster-manager

                   Allow from 192.168

                   Allow from all


               KeepAliveTimeout 300

               MaxKeepAliveRequests 0

               ManagerBalancerName mycluster

               #AdvertiseFrequency 5







          <VirtualHost *:80>


              ServerName my-app.org

              ServerAlias my-app.org

              ErrorLog /var/log/apache2/user.error.log

              LogLevel warn

              CustomLog /var/log/apache2/my_app.access.log combined

              ServerSignature On


              Redirect "/" https://my-app.org

              ProxyPreserveHost On

              SSLProxyEngine On

              ProxyPreserveHost On

              #ProxyPass /_error !

              #ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=on

              #ProxyPassReverse / balancer://mycluster



              <Location />

                  Order deny,allow

                  Allow from all





          <VirtualHost *:443>


              ServerName my-app.org

              ServerAlias my-app.org

              SSLEngine on

              SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem

              SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

              ErrorLog /var/log/apache2/user.ssl.error.log

              LogLevel warn

              CustomLog /var/log/apache2/my_app.ssl.access.log combined

              ServerSignature On


              SSLProxyEngine On

              ProxyPreserveHost On

              ProxyPass /_error !

              ProxyPass / balancer://mycluster stickysession=JSESSIONID|jsessionid nofailover=on

              ProxyPassReverse / balancer://mycluster

              <Location />

                  Order deny,allow

                  Allow from all










      Wildfly Configuration (relevant fragments):



      mod_cluster subsystem:


              <subsystem xmlns="urn:jboss:domain:modcluster:2.0">

                  <mod-cluster-config advertise-socket="modcluster"



                                      sticky-session-force="true" load-balancing-group="mycluster" connector="ajp">


                          <load-metric type="cpu"/>









              <outbound-socket-binding name="mc-prox1">

                  <remote-destination host="" port="5555"/>





      My AJP configuration:

      <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:1500}">
        <socket-binding name="ajp" port="${jboss.ajp.port:0}" />



      When I set ajp port to 8009, it works. I want to use custom port number. Does anyone have a clue how to do it?