Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rainer,

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.

Christopher,

I personally find it hard to "visualise" when exactly in the Apache request handling cycle the JkMount directive intervenes. Like, /before RewriteRule/ or /after RewriteRule/. I am sure that it is at a very specific place in the cycle and with a very specific precedence, but neither the Apache httpd nor the mod_jk documentation explicitly indicate this (*). (Unlike, for example, in this page, where the precedence is clear : http://httpd.apache.org/docs/2.2/sections.html#mergin)
And if even Rainer isn't sure..

That is why, with Apache/mod_jk, I tend to prefer working with the alternative to JkMount explained here (at the very end of the page) : http://tomcat.apache.org/connectors-doc/reference/apache.html
(section: Using SetHandler and Environment Variables)

To me, this makes it clearer, because the "proxying to Tomcat" is now embedded in a <Location> section, which has a clear precedence in the Apache configuration logic.

Using that syntax, the directives

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

would be expressed as

<Location /context/some-specific-path>
  # covers the 1st one above
  setHandler jakarta-servlet
  SetEnv JK_WORKER_NAME workerX
  # but, as an example, exclude some URLs from the proxying
  SetEnvIf REQUEST_URI "\.(css|gif|jpe?g|js)$" no-jk
  ...
</Location>
...
<LocationMatch "/context/.*\.(do|jsp)$">
  # covers #3 and #4 above
  setHandler jakarta-servlet
  SetEnv JK_WORKER_NAME workerX
  ...
</Location>

Now, the problem becomes : are these Location and LocationMatch sections evaluated before, or after the Rewrite rules ?
But for that, the Apache documentation is explicit.
Rewrite happens *before* the URL is compared to the <Location*> sections.


(*) probably, because it is difficult to explain precisely in less than 2 pages of html full of Apache internals which most users would not understand anyway, so Rainer is discouraged from even attempting to... ;-)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to