Skip to content

mod_proxy_ajp

There is no additional modules require to load balance jboss.
But we had some old services require it and we down to road for mod_proxy_ajp.
alternatively you can choose mod_cluster.

Documentation

mod_proxy_ajp

quick explanation / observation

This module does not monitor services.
But it does checking before service request if it fails it fall back to next node.

=

Sticky session can be used by setting variable name to stickysession there is many way to define it.
but result will be same.

stickysession=JSESSIONID

=

Keep in Mind

BalancerMember is AJP connector so you need to use AJP connector port number.

=

Balancer Manager is a satus page just like info-page or status-page from mod_status.

/balancer-manager

=

If you receive error as shown below.

[error] (70014)End of file found: ajp_ilink_receive() can't receive header
[error] ajp_read_header: ajp_ilink_receive failed
[error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)

Mostly likely you need to set packet size on jboss. packetSize="20000"

File: server.xml

  <Connector port="8009" address="${jboss.bind.address}"
         enableLookups="false" redirectPort="8443" debug="0"
         protocol="AJP/1.3" packetSize="20000"/>

My Configuration

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

#
# When loaded, the mod_proxy_ajp module adds support for
# proxying to an AJP/1.3 backend server (such as Tomcat).
# To proxy to an AJP backend, use the "ajp://" URI scheme;
# Tomcat is configured to listen on port 8009 for AJP requests
# by default.
#

# 
# Uncomment the following lines to serve the ROOT webapp
# under the /tomcat/ location, and the jsp-examples webapp
# under the /examples/ location.
#
#ProxyPass /tomcat/ ajp://localhost:8009/
#ProxyPass /examples/ ajp://localhost:8009/jsp-examples/


<VirtualHost 10.0.1.5:80>
ServerName linux4
<Proxy balancer://cluster>
Order deny,allow
Allow from all

BalancerMember ajp://localhost:8009/Untitled1 route=node1
BalancerMember ajp://localhost:8010/Untitled1 route=node2


ProxySet maxattempts=1
ProxySet stickysession=JSESSIONID
ProxySet timeout=300
</Proxy>

ProxyIOBufferSize 19000
LimitRequestFieldsize 18000
ProxyTimeout 300
ProxyStatus Full

ProxyPass /Untitled1 balancer://cluster/
#ProxyPassReverse /Untitled1 http://linux4/Untitled1

<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Deny from all
Allow from localhost
Allow from 10.0.0.0/4
</Location>

</VirtualHost>