Displaying Java Web App Images in Tomcat with Apache Proxy

I was stumped by my NixMashupLinks Java site favicon.ico not displaying, but there were more important issues to attend to in getting the site up so I moved on. But when I added a simple image tag in a block of text and it wouldn’t display I knew something weird was going on.

I first thought it had something to do with the site being a Java app, but that didn’t make sense. Then it dawned on me that I was using Apache’s Proxy Module with Tomcat and as a result there was directory virtuality involved.

The physical directory root of the nixmashuplinks site is


The proxy address in the site’s nixmashuplinks.conf is


with a soft link to /ubuntuland/sites/nixmashuplinks/ in the Tomcat /webapps directory.

The solution is in the Apache nixmashuplinks.conf site file. We first set aliases to any directories from which we want to serve static content like images or CSS files [1] and for our <Directory /> element use the physical path to our site (/ubuntuland/sites/nixmashuplinks/.) [2]. We then prevent the Alias directories from being served by Tomcat [3], with all other requests passed on to Tomcat. [4]

Now my Java site has a favicon and everything!