sticky session with apache web server and tomcat servers

前端 未结 6 567
我在风中等你
我在风中等你 2021-02-01 21:33

I am using apache web server as a load balancer for two tomcat instances behind apache. When the first request goes to node A and second request from the same client goes to no

6条回答
  •  情歌与酒
    2021-02-01 22:06

    None of the above solutions worked for me, but I found it in MOTECH project documentation here: http://docs.motechproject.org/en/latest/deployment/sticky_session_apache.html

    This config works for me (on Apache 2.4.41):

    
        (...)
        Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
        (...)
        
            (...)
            BalancerMember http://10.20.30.40:8080 route=backend-1 enablereuse=On
            BalancerMember http://10.20.30.41:8080 route=backend-2 enablereuse=On
    
            ProxySet lbmethod=bytraffic
            ProxySet stickysession=ROUTEID
            (...)
        
    
        ProxyPass / balancer://mycluster/
        ProxyPassReverse / balancer://mycluster/
        (...)
    
    

提交回复
热议问题