在Apache loadbalancer中保留会话

时间:2014-04-11 15:04:06

标签: php apache

我在proxy_balancer.conf中设置了以下内容,服务器正在创建cookie,但服务器仍然会在每次刷新或重定向时切换。我做错了什么?

NameVirtualHost *:80
ServerName mantra.inn650
RewriteEngine On
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/"    env=BALANCER_ROUTE_CHANGED
<Proxy balancer://mycluster>

BalancerMember http://10.6.2.2 route=1
BalancerMember http://10.6.2.3 route=2
</Proxy>
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://forumcluster/

ProxyPreserveHost on
<Proxy *>
 Order deny,allow
 Allow from all
</Proxy>

ServerName blog.mantra.inn650
RewriteEngine On
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://blogcluster>

BalancerMember http://10.6.2.2 route=1
BalancerMember http://10.6.2.3 route=2
</Proxy>
ProxyPass / balancer://blogcluster/
ProxyPassReverse / balancer://forumcluster/

ProxyPreserveHost on
<Proxy *>
 Order deny,allow
 Allow from all
</Proxy>

1 个答案:

答案 0 :(得分:0)

看起来你错过了:

ProxySet stickysession=ROUTEID指令中的

<Proxy balancer://...>

来自文档:http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html