httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: load balancer and http(s) sticky sessions
Date Thu, 14 Sep 2006 22:45:36 GMT


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

Mime
View raw message