reverse proxy and Load balancer

混江龙づ霸主 提交于 2020-08-10 19:30:06

问题


Here is the Apache Reverse proxy and load balancer, the website/reports url is not coming up

   <IfModule mod_proxy.c>
        ProxyPreserveHost On
        <Proxy balancer://app0102>
           BalancerMember https://serverapp01.com
           BalancerMember https://serverapp02.com
        </Proxy>
        ProxyPass / "balancer://app0102/"
        ProxyPassReverse "/" "balancer://app0102/"
   </IfModule>

if I point to single server, the website/reports url work

<VirtualHost *:443>
   <IfModule mod_proxy.c>
      ProxyPass / https://serverapp01.com

/ retry=1 acquire=3000 timeout=1200 Keepalive=On ProxyPassReverse / https://serverapp01.com

Website works in both cases, Any ideas on what I am missing Thanks Nate


回答1:


If your backend server is using SessionCookie then you can use the same cookie for sticky session.

<Proxy balancer://app0102>
BalancerMember https://serverapp01.com route=node1 
BalancerMember https://serverapp02.com route=node2 
</Proxy>

ProxyTimeout 60
ProxyStatus On

ProxyPass /   balancer://app0102/  stickysession=JSESSIONID|jsessionid 
ProxyPassReverse / bbalancer://app0102

If your backend server is not using Session Cookie then you can use route for sticky session.

Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e;  path=/" env=BALANCER_ROUTE_CHANGED
<Proxy "balancer://app0102">
    BalancerMember https://serverapp01.com route=node1
    BalancerMember https://serverapp02.com route=node2
    ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass / balancer://app0102/
ProxyPassReverse / balancer://app0102/

Make sure that your both backend server is running.




回答2:


I suggest using quotes on both source and destionation, such as:

ProxyPass "/" "balancer://app0102/"



来源:https://stackoverflow.com/questions/62412163/reverse-proxy-and-load-balancer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!