Tuesday, April 14, 2009

Setting up Apache and mod_proxy_html for my web application

Recently I had to set up Apache HTTP Server as a proxy to our web application running on WebLogic. Should be a simple task, except the application has a different context path when served by Apache. This is how it's set up:

Web App context path in WebLogic: http://localhost:8013/mywebapp
Web App context path in Apache: http://localhost:8080/some/extra/path/elements/mywebapp

With this configuration, the web application generate urls like http://localhost:8080/mywebapp/some/link, which causes problems since that path doesn't point to the web application. The correct url should be http://localhost:8080/some/extra/path/elements/mywebapp/some/link. After doing some research, I found the mod_proxy_html Apache module. This module parses the HTML from the web application and based on a specified rule set, it replaces urls in the HTML with rewritten, correct urls.

After following the initial configuration tutorial, I only got a message in the log saying "No links configured: nothing for proxy-html filter to do". Aparently, the documentation I read was a bit outdated, and after doing a google search, I found an article explaining some extra steps needed to get things up and working. Together with another useful guide, I was able to set things up producing the result I wanted.

This set up is not specific to WebLogic. It should work with other containers as well, such as Tomcat, Jetty etc.


webay said...

thanks for your sharing.

Igor KupczyƄski said...

Thanks for sharing, this part

> I found an article explaining some extra steps needed to get things up and working.

saved me :-)