As you might have noticed, there are many ways to load-balance a Glassfish cluster to serve the need to spread risk and load. The most easy , cheap and fastest by far is using the default feature available in Apache, mod_proxy.
Here is a default setup on how to setup a load-balancing Virtual Host in Apache, which i use mostly.
<VirtualHost 10.0.0.30:80> ServerName acc.backoffice.yenlo.nl UseCanonicalName On ErrorLog /var/log/httpd/acc.backoffice.yenlo.nl.error.log CustomLog /var/log/httpd/acc.backoffice.yenlo.nl.access.log combined RewriteEngine On ProxyRequests off ProxyPreserveHost On # DENY All by default <Location /> Order Allow,Deny </Location> # ALLOWED locations <Location /backoffice> Order Deny,Allow Deny from all # And only allow from internal network Allow from 10.0.0.0/8 </Location> <Proxy *> Order deny,allow Allow from all </Proxy> <Proxy balancer://clacc-backoffice> BalancerMember http://gfnode01.yenlo.nl:38081/ BalancerMember http://gfnode02.yenlo.nl:38081/ </Proxy> <Location /balancer-manager> SetHandler balancer-manager Order Deny,Allow Deny from all # Only allow from internal network Allow from 10.0.0.0/8 </Location> ProxyPass / balancer://clacc-backoffice/ stickysession=JSESSIONID ProxyPassReverse / http://gfnode01.yenlo.nl:38081/ ProxyPassReverse / http://gfnode02.yenlo.nl:38081/ </VirtualHost>
As you can see we only allow 1 location to be forwarded, the rest is forbidden by default as there is no location defined.
In this way you are able to present only these location of your application / web-services per virtual host location.
This solution will give you the most flexibility for hosting your application using multiple virtual hosts.