You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Falco Schwarz <hi...@falco.me> on 2014/06/18 15:35:17 UTC
[users@httpd] RewriteCond if no handler matches
All,
I am trying to setup an httpd server with multiple tomcat backends using
mod_jk.
Currently, my setup looks kinda like this (only relevant parts):
<VirtualHost *:80>
DocumentRoot /docroot
ServerName www.example.com
<Location /server-status
SetHandler server-status
</Location>
JkMount /app1/* backend1
JkMount /app2/* backend2
JkMount ...
</VirtualHost>
Now, I would like to setup a RewriteRule, which accoplishes the following
task:
Rewrite all requests to /app1/ which are not matched by:
- /error/* (a static directory on apache)
- any JkMount (because there will probably be lots of JkMounts)
- any Handler (Apache Status, JK Status, ldap Status ... etc)
Is there a RewriteCond I am missing? I am trying to avoid a whole lot of
REQUEST_URI RewriteCond's to accomplish this task. I already tried using
mod_jk notes [1], but unfortunately they are not matched by %{ENV: ...}.
Also, that wouldn't solve the problem with all those Handlers.
The only "Solution" I came up with was:
ErrorDocument 404 http://www.example.com/app1/
If apache is unable to serve the file, the request gets redirected to
/app1/.
Is there a way to accomplish this using mod_rewrite and a "clearer"
approach?
Regards,
Falco
[1] http://tomcat.apache.org/connectors-doc/reference/apache.html