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.

Tuesday, January 20, 2009

Problem with Git on Windows

Just a little tip from a Git newbie using Windows and msysGit. Yesterday I couldn't push changes to my GitHub repository. I have no idea why... Maybe it had something to do with the size and number of files in the change set? Anyway, I kept getting error messages saying "unable to read from standard input" and "remote end hung up unexpectedly". After struggling with the problem for a while, I tried switching from PuTTY plink.exe to TortoiseSVN TortoisePlink.exe as the SSH client (export GIT_SSH="C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe"), and for some reason, everything started to work again.

If anyone know why this problem occured, and why it was solved by switching SSH client, please let me know.