[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: Combining Apache RewriteRule and JkMount to pass through to Tomcat
From:       André_Warnier <aw () ice-sa ! com>
Date:       2009-06-27 8:21:57
Message-ID: 4A45D6A5.2000900 () ice-sa ! com
[Download RAW message or body]

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 :
http://tuckey.org/urlrewrite/

---
But for now, let's take as a given that you need an httpd in front of 
Tomcat.
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
   ...
</Location>

Full description here :
http://tomcat.apache.org/connectors-doc/reference/apache.html
(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).
E.g.
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic