tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Combining Apache RewriteRule and JkMount to pass through to Tomcat
Date Sat, 27 Jun 2009 08:21:57 GMT
David Crane wrote:
As has been pointed out several times on this forum, if the question is 
just to serve some static content along with the dynamic Java-produced 
content, Tomcat is comparable to Apache httpd as a pure webserver.

If you need to rewrite some URLs nevertheless, you should have a look at 
the following Tomcat servlet filter, which achieves under Tomcat most if 
not all of what mod_rewrite does under Apache :

But for now, let's take as a given that you need an httpd in front of 
You may or may not be aware of the following syntax under Apache, which 
is an alternative to the JkMount/JkUnmount directives :

<Location /anyurl>
   SetHandler jakarta-servlet
   SetEnvIf (some condition) no-jk

Full description here :
(at the very bottom of the page)

You can use any Location or LocationMatch sections with this.
The SetHandler does basically the same as what a "JkMount *" would do in 
this case, while the "SetEnvIf no-jk" does the same as JkUnmount (but 
with a lot more flexibility).
SetEnvIf REQUEST_URI "\.(gif|jpg|css|js)$" no-jk

I personally prefer that form, because it fits better with the usual 
syntax of Apache httpd, and I find it easier to combine with other 
Apache directives like RewriteRule, SetEnvIf etc...
It's also easier to figure out when exactly things happen.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message