Mod Proxy is used to send the incoming request to backend Application server's . For ex: if we browse https://webserver/ABC then Web server proxy will forward to back end application server based on the Proxy Pass member .
Scenario 1. In this case backend has only one Application server .
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#### Proxy pass to only one backend server #####
ProxyPass /login https://appserver.com/login
ProxyPassReverse /login https://appserver.com/login
Scenario 2 : In this case backend has 2 (more than 1 app server )
#### ABC Proxy pass to multiple backend server #####
Header add Set-Cookie "ABCROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/ABC" "expr=reqenv('BALANCER_ROUTE_CHANGED')==1 && reqenv('BALANCER_NAME')=='balancer://abcbalencer'"
<Proxy balancer://abcbalencer>
BalancerMember https://xx.xx.xx.xx:9443 route=app1a retry=60 loadfactor=1 timeout=600 connectiontimeout=10 keepalive=on
BalancerMember https://xx.xx.xx.xx:9444 route=app2a retry=60 loadfactor=1 timeout=600 connectiontimeout=10 keepalive=on
</Proxy>
ProxyPass "/ABC" "balancer://abcbalencer/ABC" stickysession=ABCROUTEID|jsessionid|JSESSIONID nofailover=off
ProxyPassReverse "/ABC" "balancer://abcbalencer/ABC"
ProxyPass "/ABC1" "balancer://abcbalencer/ABC1" stickysession=ABCROUTEID|jsessionid|JSESSIONID nofailover=off
ProxyPassReverse "/ABC1" "balancer://abcbalencer/ABC1"
Scenario 3: On scenario 2 if the application is down and server is up then still web sever will send request to back end . so will get 404 error for end user .
Below helthcheck template will help to get rid of such error's .if the backend server respond with 200 code then only send back the request .There is frequent helth check to configured page . Below is very good recomended configuration for PRODUCTION Environments .
#### ABC Proxy pass to multiple backend server With HealthCheck Template #####
ProxyHCExpr ok200 {%{REQUEST_STATUS}=~/^[200]/}
Header add Set-Cookie "ABCROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/ABC" "expr=reqenv('BALANCER_ROUTE_CHANGED')==1 && reqenv('BALANCER_NAME')=='balancer://abcbalencer'"
<Proxy balancer://abcbalencer>
BalancerMember https://xx.xx.xx.xx:9443 route=app1a retry=60 loadfactor=1 timeout=600 connectiontimeout=10 keepalive=on hcmethod=GET hcexpr=ok200 hcuri=/ABC/index.html hcinterval=10
BalancerMember https://xx.xx.xx.xx:9444 route=app2a retry=60 loadfactor=1 timeout=600 connectiontimeout=10 keepalive=on hcmethod=GET hcexpr=ok200 hcuri=/ABC/index.html hcinterval=10
</Proxy>
ProxyPass "/ABC" "balancer://abcbalencer/ABC" stickysession=ABCROUTEID|jsessionid|JSESSIONID nofailover=off
ProxyPassReverse "/ABC" "balancer://abcbalencer/ABC"
ProxyPass "/ABC1" "balancer://abcbalencer/ABC1" stickysession=ABCROUTEID|jsessionid|JSESSIONID nofailover=off
ProxyPassReverse "/ABC1" "balancer://abcbalencer/ABC1"
No comments:
Post a Comment