On 9/14/06, Ruediger Pluem <[EMAIL PROTECTED]> wrote:


On 09/14/2006 09:50 PM, Ruediger Pluem wrote:

>
>
> or even
>
> Header add Set-Cookie "MYCOOKIE=SOMEVALUE.%{BALANCER_WORKER_ROUTE}e; path=/;" 
env=BALANCER_ROUTE_CHANGED
> ProxyPass /test balancer://mycluster/test stickysession=MYCOOKIE nofailover=On

Ok I think it should be

Header add Set-Cookie "MYCOOKIE=SOMEVALUE.%{BALANCER_WORKER_ROUTE}e; path=/;" 
env=BALANCER_ROUTE_CHANGED
ProxyPass /test balancer://mycluster/test stickysession=MYCOOKIE

and the following patch should handle this (done only very quick tests):

Index: modules/proxy/mod_proxy_balancer.c
===================================================================
--- modules/proxy/mod_proxy_balancer.c»·(Revision 443474)
+++ modules/proxy/mod_proxy_balancer.c»·(Arbeitskopie)
@@ -267,6 +267,13 @@
          * Find the worker that has this route defined.
          */
         worker = find_route_worker(balancer, *route, r);
+        if (worker && strcmp(*route, worker->s->route)) {
+            /* Notice a change in the route */
+            apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+                         "proxy: BALANCER: Route changed from %s to %s",
+                         *route, worker->s->route);
+        }
         return worker;
     }
     else
@@ -424,6 +431,10 @@

             return HTTP_SERVICE_UNAVAILABLE;
         }
+        if ((*balancer)->sticky && runtime) {
+            /* Notice a change in the route */
+            apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
+        }
         *worker = runtime;
     }


Regards

Rüdiger


Regarding this:

http://mail-archives.apache.org/mod_mbox/httpd-dev/200606.mbox/[EMAIL PROTECTED]

I was actually hoping that this (below) would solve that, but I have
not had the time to look into it.  I still think it is a step in the
right direction, though:

http://mail-archives.apache.org/mod_mbox/httpd-dev/200609.mbox/[EMAIL PROTECTED]

I am thinking that there is still not a way to check if
BALANCER_WORKER_ROUTE == BALANCER_SESSION_ROUTE at response time since
I think 'SetEnvIf response ...' will not resolve env vars it did not
set (at least that is what the docs hint at - have not tried).

So, this BALANCER_ROUTE_CHANGED patch is still needed.  I have been
meaning to send it but you got to it first :)  Will you commit that to
trunk?

Also, I would like my patches (now in trunk) and this additional
BALANCER_ROUTE_CHANGED patch to go into the next 2.2.x release if that
seems ok.  Is this something you would do, or do you want me to put
togeather a 2.2.x patch?

Thanks,
-B

Reply via email to