Just looking into my options for setting up java web applications, not wanting to give them root to run on port 80, but obviously wanting the world to think they run on port 80. After looking at the various java solutions (mod_jk, mod_webapp, etc), I ‘found’ mod_proxy in Apache 2.0, specifically the ProxyPass and ProxyPassReverse.
Since I am using JBoss 3.0, I will use it as an example. JBoss ships with a JMX management web application, bundled as jmx-console.war. This means if you start the default JBoss, by running bin.run.sh, you get a working Java application server at port 8080 on that machine. Lets assume that you are running Apache 2.0 on the same machine. This means if you want to access the jmx-console.war application, you will navigate your browser to http://localhost:8080/jmx-console/. This is going to be terribly inconvenient to some people who have never used a port number in a URL before.
So, we modify the Apache config as follows:
ProxyPass /jmx/ http://localhost:8080/jmx-console/ ProxyPassReverse /jmx/ http://localhost:8080/jmx-console/
Now, when you restart Apache, you get your jmx-console webapp ‘hiding’ on port 80, such that when you navigate to http://localhost/jmx/, Apache secretly forwards the requests to JBoss, then proxies them back to you. The ProxyPassReverse line allows your webapp to throw a redirect, and even that will work. This Apache stuff will catch on some day
You can even get Apache to cache all the static files!
Popularity: 16%