]> granicus.if.org Git - apache/commitdiff
* Add the following environment variables to expose the information
authorRuediger Pluem <rpluem@apache.org>
Mon, 26 Jun 2006 16:59:38 +0000 (16:59 +0000)
committerRuediger Pluem <rpluem@apache.org>
Mon, 26 Jun 2006 16:59:38 +0000 (16:59 +0000)
* about
  the route, the sticky session and the worker used during a request to
  other modules:

  BALANCER_SESSION_STICKY
  BALANCER_SESSION_ROUTE
  BALANCER_NAME
  BALANCER_WORKER_NAME
  BALANCER_WORKER_ROUTE

PR: 39806
Submitted by: Brian <brectanu gmail.com>
Reviewed by: rpluem

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@417238 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
docs/manual/mod/mod_proxy_balancer.xml
modules/proxy/mod_proxy_balancer.c

diff --git a/CHANGES b/CHANGES
index c35fe48fb5962cc889a9144eabbb692e0d1600e4..21f7ea15283ea11d88211ba25dd85a05829d90ba 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) mod_proxy_balancer: Add information about the route, the sticky session
+     and the worker used during a request as environment variables. PR 39806.
+     [Brian <brectanu gmail.com>]
+
   *) mod_isapi: Avoid double trailing slashes in HSE_REQ_MAP_URL_TO_PATH
      support.  Also corrects the slashes for Windows.  PR 15993  [William Rowe]
 
index 1fa7360736993e5d3e01fb349ffdda3a2f13411d..c0cb40d072e12d63803093ea9d60307a1c803867 100644 (file)
@@ -271,6 +271,47 @@ candidate lbstatus -= total factor</code></pre>
 
 </section>
 
+<section id="environment">
+    <title>Exported Environment Variables</title>
+    <p>At present there are 5 environment variables exported:</p>
+    
+    <!-- ============= BALANCER_SESSION_STICKY =============== -->
+    <dt><var><a name="balancer_session_sticky" id="balancer_session_sticky">BALANCER_SESSION_STICKY</a></var></dt>
+    <dd>
+    <p>This is assigned the <var>stickysession</var> value used in the current
+    request.  It is the cookie or parameter name used for sticky sessions</p>
+    </dd>
+
+    <!-- ============= BALANCER_SESSION_ROUTE ================ -->
+    <dt><var><a name="balancer_session_route" id="balancer_session_route">BALANCER_SESSION_ROUTE</a></var></dt>
+    <dd>
+    <p>This is assigned the <var>route</var> parsed from the current 
+    request.</p>
+    </dd>
+
+    <!-- ============= BALANCER_NAME ========================= -->
+    <dt><var><a name="balancer_name" id="balancer_name">BALANCER_NAME</a></var></dt>
+    <dd>
+    <p>This is assigned the name of the balancer used for the current 
+    request. The value is something like <code>balancer://foo</code>.</p>
+    </dd>
+
+    <!-- ============= BALANCER_WORKER_NAME ================== -->
+    <dt><var><a name="balancer_worker_name" id="balancer_worker_name">BALANCER_WORKER_NAME</a></var></dt>
+    <dd>
+    <p>This is assigned the name of the worker used for the current request.
+    The value is something like <code>http://hostA:1234</code>.</p>
+    </dd>
+
+    <!-- ============= BALANCER_WORKER_ROUTE ================= -->
+    <dt><var><a name="balancer_worker_route" id="balancer_worker_route">BALANCER_WORKER_ROUTE</a></var></dt>
+    <dd>
+    <p>This is assigned the <var>route</var> of the worker that will be 
+    used for the current request.</p>
+    </dd>
+
+</section>
+
 <section id="enable">
     <title>Enabling Balancer Manager Support</title>
     <p>This module <em>requires</em> the service of 
index de1a15a476c00d61844a91c64e05178228ed29df..e76dd1cfbcb375f6d9a77f7b606eb402bde205a7 100644 (file)
@@ -389,6 +389,14 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
         *worker = runtime;
     }
 
+    /* Add balancer/worker info to env. */
+    apr_table_setn(r->subprocess_env,
+                   "BALANCER_NAME", (*balancer)->name);
+    apr_table_setn(r->subprocess_env,
+                   "BALANCER_WORKER_NAME", (*worker)->name);
+    apr_table_setn(r->subprocess_env,
+                   "BALANCER_WORKER_ROUTE", (*worker)->s->route);
+
     /* Rewrite the url from 'balancer://url'
      * to the 'worker_scheme://worker_hostname[:worker_port]/url'
      * This replaces the balancers fictional name with the
@@ -399,6 +407,12 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
     if (route) {
         apr_table_setn(r->notes, "session-sticky", (*balancer)->sticky);
         apr_table_setn(r->notes, "session-route", route);
+
+        /* Add session info to env. */
+        apr_table_setn(r->subprocess_env,
+                       "BALANCER_SESSION_STICKY", (*balancer)->sticky);
+        apr_table_setn(r->subprocess_env,
+                       "BALANCER_SESSION_ROUTE", route);
     }
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                  "proxy: BALANCER (%s) worker (%s) rewritten to %s",