apache : Obtain part of url in proxy balancer from one balancer member
I have cluster setup of Apache server . Behind this I have 2 Jboss instances which is load balanced by apache.
The configuration look somewhat like the below <VirtualHost *:1111> ServerAdmin admin@example.com ServerName www.example.com DocumentRoot "/apps" ErrorLog "logs/https.www.example.com.-error_log" TransferLog "logs/https.www.example.com-access_log" LogLevel warn <Directory "/apps"> Options -Indexes +FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> SSLProxyEngine On SSLProxyVerify On SSLProxyMachineCertificateFile "/apps/apache/conf/ssl/int/proxy.pem" SSLProxyCACertificateFile "/apps/apache/conf/ssl/int/cert.pem" RewriteEngine On Header set Cache-Control "max-age=60, public" <Proxy balancer://2node-aa> BalancerMember https://app01:8089 route=node1 BalancerMember https://app02:8089 route=node2 ProxyPreserveHost On ProxyPass /aa balancer://2node/aa stickysession=JSESSIONID|jsessionid ProxyPass /static balancer://2node/static stickysession=JSESSIONID|jsessionid ProxyPassReverse /aa balancer://2node/aa ProxyPassReverse /static balancer://2node/static ProxyPass /1/aa https://app01:8089/aa ProxyPass /2/aa https://app02:8089/aa ProxyPassReverse /1/aa https://app01:8089/aa ProxyPassReverse /2/aa https://app02:8089/aa ProxyPass /bb balancer://2node/rest stickysession=JSESSIONID|jsessionid ProxyPassReverse /bb balancer://2node/bb </VirtualHost> In the url access certain part of the url i want it to be routed from second node i.e node2 of jboss. e.g. if i am accessing http://www.example.com/aa/login/login.jsp i need this request to be process by node2 app02 only. Rest of the request should load balance as normal access. How do i set the apache to do it ? I have tried lot of rewrite,<Location> and ProxyPassMatch none has worked so far. Please Help. Thanks in advance. |
You need to separate the nodes into different balancers. e.g. here's my apache config for balancing reads and writes across servers.
Code:
# Load balancing to different nodes based on type of requests SAM |
Hi SAM,
Thanks for your reply. I did try this but it does not work. <Proxy balancer://2node-aa> BalancerMember https://app02:8080 route=node2 </Proxy> RewriteRule ^/aa/login/(.*)$ balancer://2node-aa$1 [P] I had put it just above the balancer with two node. Don't see any error in the log file. |
I used the below statement in the configuration file which resolved the issue.
<Proxy balancer://2node-aa> BalancerMember https://app02:8080 route=node2 </Proxy> RewriteRule ^/aa/login/(.*)$ balancer://2node-aa%{REQUEST_URI} [P,QSA,L] This link help me. http://stackoverflow.com/questions/1...url-redirectio -Thanks |
Quote:
Code:
<Proxy balancer://2node-aa> Code:
RewriteRule ^/aa/login/(.*)$ balancer://2node-aa$1 [P] Code:
RewriteRule ^(/aa/login/.*)$ balancer://2node-aa$1 [P] SAM |
All times are GMT -5. The time now is 01:41 AM. |