We are using Apache to load balance our backend (IIS) web servers. Our configuration follows an example from Apache doc. We try to achieve sticky routing (i.e. subsequent requests from the same client will be routed to the same upstream server) with a cookie set by Apache.
Our configuration looks like:
ProxyRequests off
ProxyPreserveHost On
<Proxy balancer://oursitename>
allow from all
BalancerMember http://1.2.3.4:80 route=1
# Further servers will be added here
ProxySet stickysession=ROUTEID
</Proxy>
# This line should set the correct cookie..
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
ProxyPass /balancer-manager !
ProxyPass / balancer://oursitename/ nofailover=Off
ProxyPassReverse / http://1.2.3.4:80/
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
Allow from all
</Location>
Now Apache seems not to include the actual route, but the cookie does only contain the dot ".". I checked with Firebug and Wireshark. So in every HTTP response header appears (i.e. for each image/css/js):
Set-Cookie: ROUTEID=.; path=/
Surprisingly, when reloading the page about twice, suddenly there appears a Set-Cookie: ROUTEID=.2 in one of about ten responses. The browser uses this value in subsequent requests, which are then NOT acked by further Set-Cookie entries. So it seems like Apache accepts the route .2 as valid. I don't understand why it is always the .2, this number appears even if I remove the second server from the balancer!
Can anyone explain me what happens here and how I can fix it?