This configuration provides a way for load balancing with
stickiness using mod_headers.
Add following configuration in
APACHE_HOME/conf/httpd.conf
configuration
file.
LoadModule headers_module modules/mod_headers.so
<VirtualHost *:80>
ServerName lb.xyz.com
ServerAlias lb.xyz.com
ProxyRequests Off
ProxyPreserveHost On
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://cluster>
BalancerMember http://abc.com:8080 route=1
BalancerMember http://xyz.com:8080 route=2
ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass / balancer://cluster/
ProxyPassReverse / balancer://cluster/
</VirtualHost>
|
|
|