views:

230

answers:

1

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?

+2  A: 

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.

laz
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