tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r446948 - in /tomcat/connectors/trunk/jk/xdocs: config/apache.xml howto/apache.xml
Date Sat, 16 Sep 2006 20:36:40 GMT
Author: rjung
Date: Sat Sep 16 13:36:40 2006
New Revision: 446948

Explain how to use SetHandler and env vars to control mod_jk
behaviour. Part of the functionality is old, but has never been
documented, part of it is new.


Modified: tomcat/connectors/trunk/jk/xdocs/config/apache.xml
--- tomcat/connectors/trunk/jk/xdocs/config/apache.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/config/apache.xml Sat Sep 16 13:36:40 2006
@@ -38,6 +38,9 @@
 <attribute name="JkMountCopy" required="false"><p>
 Should the base server mounts be copied to the virtual server.
+<attribute name="JkWorkerIndicator" required="false"><p>
+Name of the Apache environment variable that can be used to set worker names.
 <attribute name="JkLogFile" required="false"><p>
 Full or server relative path to the Tomcat Connector module log file
@@ -540,6 +543,53 @@
 applications. Apache will reload the file and update the mount
 points within 60 second interval.
+<subsection name="Using SetHandler and Environment Variables">
+Alternatively to the mod_jk specific directives, you can also use
+SetHandler and environment variables to control, which requests
+are being forwarded via which worker. This gives you more flexibility,
+but the results might be more difficult to understand. If you mix both
+ways of defining the forwards, in general to mod_jk directives will win.
+<b>SetHandler jakarta-servlet</b> forces requests to be handled by mod_jk.
+If you neither specify any workers via JkMount and the related directives,
+not via the environment variable described below,
+the first worker in the list of all worker will be chosen. You can use SetHandler
+for example in Location blocks or with Apache 2.2 also in RewriteRule.
+In order to control the worker using <b>SetEnvIf</b> or <b>RewriteRule</b>
+for more complex rules, you can set the environment variable <b>JK_WORKER_NAME</b>
+to the name of your chosen target worker. This enables you to decide on
+the chosen worker in a more flexible way, including dependencies on cookie values.
+In order to use another variable than <b>JK_WORKER_NAME</b>, you can set the
+of this variable via the <b>JkWorkerIndicator</b> directive.
+Finally you can define exclusions from mod_jk forwards by setting the environment
+variable <b>no-jk</b>.
+  # Automatically map all encoded urls
+  &lt;Location *;jsessionid=&gt;
+    SetHandler jakarta-servlet
+    SetEnv JK_WORKER_NAME my_worker
+  &lt;/Location&gt;
+  # Map all subdirs to workers via naming rule
+  # and exclude static content.
+  &lt;Location /apps/&gt;
+    SetHandler jakarta-servlet
+    SetEnvIf REQUEST_URI ^/apps/([^/]*)/ JK_WORKER_NAME $1
+    SetEnvIf REQUEST_URI ^/apps/([^/]*)/static no-jk
+  &lt;/Location&gt;

Modified: tomcat/connectors/trunk/jk/xdocs/howto/apache.xml
--- tomcat/connectors/trunk/jk/xdocs/howto/apache.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/howto/apache.xml Sat Sep 16 13:36:40 2006
@@ -608,7 +608,7 @@
-Starting with mod_jk 1.2.6, and under Apache 2.0, it's possible to exclude some URL/URI from
+Starting with mod_jk 1.2.6 for Apache 2.0 and 1.2.19 for Apache 1.3, it's possible to exclude
some URL/URI from
 jk processing by setting the env var <b>no-jk</b>, for example with the SetEnvIf

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

View raw message