问题
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