You are working in a company with some internal servers only accessible from inside the firewall. You now want to grant users from the outside access to these servers by using a reverse proxy.
You have one server containing white papers written by your company and want to let people view the public ones. You also have a intranet server, containing information to your staff that would be good if the staff could access off hours or when they are working from abroad.
You decide to have the white papers as the standard page since that is what most people visiting your page are looking for. You however only want people to visit white papers marked as public. You therefore add a server mapping all requests to beta.company.com/public
<server className="net.sf.j2ep.servers.BaseServer" domainName="beta.company.com" path="/public"> <rule className="net.sf.j2ep.rules.AcceptEverythingRule" /> </server>
The intranet server should be accessed only by your own staff. But since they should be able to access it from any computer you simply add a login to the page and put up the server under /intranet.
<server className="net.sf.j2ep.servers.BaseServer" domainName="intra.company.com"> <rule className="net.sf.j2ep.rules.DirectoryRule" directory="/intranet" /> </server>
Remember that the rules are processed until one match is found, therefore you will have to put he DirectoryRule before the AcceptEverythingRule, resulting in the following data.xml
<?xml version="1.0" encoding="UTF-8"?> <config> <server className="net.sf.j2ep.servers.BaseServer" domainName="intra.company.com"> <rule className="net.sf.j2ep.rules.DirectoryRule" directory="/intranet" /> </server> <server className="net.sf.j2ep.servers.BaseServer" domainName="beta.company.com" path="/public"> <rule className="net.sf.j2ep.rules.AcceptEverythingRule" /> </server> </config>
Opening up the company's list of white papers had a great response from the customers. Unfortunately this also made the server go down due to the heavy load. You decided to start two additional servers to balance the load on beta.company.com. After the new servers are deployed you have to change the config of J2EP so it uses the new servers as well as beta.company.com. This is very easy to do, just change the BaseServer to a RoundRobinCluster and we are done. The server config would look like this.
<server className="net.sf.j2ep.servers.RoundRobinCluster"> <server domainName="beta.company.com" path="/public" /> <server domainName="gamma.company.com" path="/public" /> <server domainName="delta.company.com" path="/public" /> <rule className="net.sf.j2ep.rules.AcceptEverythingRule" /> </server>