How can I force a request through mod_jk down to a specific worker?
-
03-07-2019 - |
Question
If I have mod_jk set up with several workers and a load balancer worker, is there a request parameter or something that would allow me to force a specific http request down to a specific worker. For instance if I have a worker worker1 is there something like this:
http://www.example.com?worker=worker1
Often we need to troubleshoot problems on a specific server in the cluster and being able to force the request directly to that server is essential.
Solution 2
Tweak the value of your JSESSIONID cookie. The end has the name of the worker you're stuck to (assuming you're doing sticky sessions)
Use SetHandler as described here http://tomcat.apache.org/connectors-doc/reference/apache.html instead of JKMount directives
Something like this:
<Location /> SetHandler jakarta-servlet SetEnvIf REQUEST_URI ^/.*\?.*worker=(\w+)&?$ JK_WORKER_NAME=$1 </Location>
OTHER TIPS
I think the common practice is to do that via subdomains which alias the main domain. Just make sure that you don't let Google index because you'll have duplicate content issues. IP filtering and a restrictive robots.txt will do the job.
www1.example.com
www2.example.com