Configuration of Apache 2.4 mod_cluster for JBoss EAP 6.4 Domain
gian.honorio May 8, 2019 6:15 PMHello, I have an application that runs with JBoss EAP 6.4 in domain mode, and I'm trying to configure an Apache with module mod_cluster to do the load balancing, however I'm having some difficulty setting up the proxy. Below are the settings that I tried to use:
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" proxy-list="192.168.8.91:6666" balancer="myCluster" sticky-session="true" sticky-session-force="false" connector="ajp">
<dynamic-load-provider>
<load-metric type="busyness"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
<IfModule manager_module>
Listen 6666
ManagerBalancerName myCluster
<VirtualHost *:6666>
<Location />
Require all granted
</Location>
KeepAliveTimeout 5
MaxKeepAliveRequests 0
AdvertiseFrequency 30
EnableMCPMReceive on
<Location /modcluster_manager>
SetHandler mod_cluster-manager
Order deny,allow
Allow from 192.168.0.0/23
Require all granted
</Location>
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /server-status !
ProxyPass / http://192.168.8.91:6666/app/
ProxyPassReverse / http://192.168.8.91:6666/app/
ProxyPassReverseCookiePath / /
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 192.168.0.0/23
</Location>
</VirtualHost>
</IfModule>
With these settings I was able to get the desired result, but I noticed that with each request made by a client, the Apache server creates one more, I imagine that because of how the proxy was configured, which makes the application performance severely impaired. So I tried different setup:
<IfModule manager_module>
Listen 6666
ManagerBalancerName myCluster
KeepAliveTimeout 5
MaxKeepAliveRequests 0
AdvertiseFrequency 30
RewriteEngine on
RewriteRule "^/$" "/app/" [R,L]
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 192.168.0.0/23
</Location>
<VirtualHost *:6666>
EnableMCPMReceive on
<Location />
Require all granted
</Location>
<Location /modcluster_manager>
SetHandler mod_cluster-manager
Order deny,allow
Allow from 192.168.0.0/23
Require all granted
</Location>
</VirtualHost>
</IfModule>
Using this second configuration I noticed that the performance improves a lot and the requests are not duplicated, however I was not able to remove the "/app" from the url, because I believe it is only possible to do this using the proxy.
What I want to do is: Any request that Apache receives on port 80 it should redirect to the Jboss load balancer. What is the bestt, most efficient and most correct way to do this?