tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: [OT] Using httpd's mod_rewrite with mod_jk
Date Fri, 02 Jul 2010 00:37:02 GMT
Hash: SHA1


On 7/1/2010 4:54 AM, Rainer Jung wrote:
> Usually mod_rewrite is perfectly compatible with mod_jk. I must confess,
> that I'm not 100% sure about the case, where you try to rewrite a
> request that originally would have been handled by mod_jk to something
> that should not be handled by it.

It appears that my setup (rewriting a request that normally would go to
jk to one that shouldn't go to jk) still ends up being handled by jk.

> Two possibilities: if it doesn't actually work, you can set the env var
> "no-jk" as a side effect in your rewrite rule. If mod_jk fins this env
> var set, it will decline to handle the request. Alternatively, if you
> are fine with redirecting by mod_rewrite instead of rewriting
> internally, the redirecting should also win over mod_jk.

Okay, I changed my RewriteRule to this:

        RewriteRule .* /bad-browser.shtml [L,E=no-jk]

...and the result is that jk still appears to handle the request.

> There is a chance though, that it should work out of the box and you are
> using some indirect mapping to mod_jk that wins. That would be the case
> if you are either using one of the outdated "JkOptions ForwardXXX"
> options, or you are using an indirect mapping like setting the handler
> to "jakarta-servlet", or using the environment variable trick
> (JK_WORKER_NAME or JkWorkerIndicator) to define the target worker.
> So you might want to tell us, how you map your dynamic requests
> (JkMount, setting handler etc.) to mod_jk and what other Jk directives
> (like JkOptions) you are using.

My Jk setup is simple like this:
   JkLogFile /var/log/apache2/mod_jk.log
   JkLogLevel Info

   JkShmFile /var/log/apache2/jk-runtime-status
   JkWorkersFile /etc/apache2/

   JkStripSession On

   JkMount /context/some-specific-path/foo workerX
   JkMount /context/some-other-path/bar workerX
   JkMount /context/*.do workerX
   JkMount /context/*.jsp workerX

I don't currently have any JKOptions explicitly set.

I should certainly have mentioned this earlier: I'm working with
mod_jk-1.2.30 on Apache httpd 2.2.9 (Debian).

> To complete the picture: in cases were the RewriteRule works, but then
> the request is not forwarded via mod_jk although it should, you need to
> add the PT flag. In your case I guess its the opposite situation you are
> looking for.

Exactly. If there were a !PT flag, I'd use that ;)

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


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

View raw message