Setting up URL Shortening Servlet behind Apache
Today I worked on setting up my URL redirection servlet (download) in our office to share internal links with my colleagues. I deployed it in JBoss. When I deployed this module as r.war, JBoss complained saying java.lang.IllegalArgumentException: Prefix string too short. I renamed the war as redir.war and deployed it.
When I tried accessing the JBoss URL from another system in the network, I found that JBoss was not accepting connection from other systems in the network. Then I configured Apache to use ProxyPass:
ProxyPass /r http://localhost:1111/redir ProxyPassReverse /r http://localhost:1111/redir
Note: JBoss was listening in port 1111 in my case. I added this to my apache configuration and restarted Apache. Now I have a cute URL shortening service which is accessible as http://myhost/r/<string>.