Take the 2-minute tour ×

We have an existing situation where we have Apache 2.0 HTTPD acting as the load balancer for a cluster of backend tomcats, using mod_jk 1.2 to communicate between the two. The applications themselves are stored on the tomcat servers, and so all requests are passed through (even images, css, etc) to tomcat, using the following in the virtual host configs:

JkMount /* worker-name

The virtual hosts do not have a DocumentRoot defined, since all traffic goes down the pipe to tomcat.

We would like to start serving static content direct from Apache (a radical idea, I know). Given our application path structure, the only way to distinguish static from dynamic content is the file extension of the requested path. So, for example, all requests ending in .jpg, .css, .ico, etc would not be passed through the JkMount, but instead served from a DocumentRoot.

So that's the context. My question is, how can I confgiure the vhost so that all requests which match a given pattern (specifically, my pattern of what we want to be served from apache) are served from the DocumentRoot, and all others passed to tomcat?

Can this be done with a regex in JkMount? Is JkMount that flexible? If not, can I make use of mod_rewrite?

share|improve this question
It occurs to me that this might be seen as more serverfault.com material, but since this is tightly coupled to me existing application path structure, I put it here. –  skaffman Jun 30 '09 at 15:33

1 Answer 1

up vote 3 down vote accepted

You can use JkUnMount to indicate that certain requests not get handled by mod_jk. I've seen examples using file extensions and paths:

JkMount /* worker-name
JkUnMount /*.jpg worker-name
JkUnMount /images/* worker-name

See here for more information.

share|improve this answer
In the end I decided to use the no-jk environment variable, which I read about on the link you provided, so I'll take your answer, thanks :) –  skaffman Jul 1 '09 at 16:07

Your Answer


