简体   繁体   中英

reverse proxy and Load balancer

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

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM