You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Carlos del Castillo <cc...@qoslabs.com> on 2011/03/24 17:14:50 UTC
[users@httpd] reverse proxy based on user agent
Hello everyone, I have a web server that is load balancing two tomcat servers using the proxy module, all is working well but now I need to add a third one, but we need to send very specific user_agents to that third server. The URLs must be the same.
Right now my configuration looks like this:
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Proxy balancer://cluster>
BalancerMember ajp://server1:8009 route=as1 loadfactor=50
BalancerMember ajp://server2:8009 route=as2 loadfactor=50
</Proxy>
ProxyPass / balancer://cluster/ stickysession=JSESSIONID
ProxyPassReverse / balancer://cluster/
I've bee looking to the mod_rewirte module, but I'm not sure how I could add the third server and only send the specific user agents to that server.
Any suggestions or pointers are welcome.
Thanks a lot!
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] reverse proxy based on user agent
Posted by Jeroen Geilman <je...@adaptr.nl>.
On 03/24/2011 05:14 PM, Carlos del Castillo wrote:
> Hello everyone, I have a web server that is load balancing two tomcat servers using the proxy module, all is working well but now I need to add a third one, but we need to send very specific user_agents to that third server. The URLs must be the same.
>
> Right now my configuration looks like this:
>
>
> ProxyRequests Off
> ProxyVia Off
> ProxyPreserveHost On
>
> <Proxy *>
> Order deny,allow
> Allow from all
> </Proxy>
>
> <Proxy balancer://cluster>
> BalancerMember ajp://server1:8009 route=as1 loadfactor=50
> BalancerMember ajp://server2:8009 route=as2 loadfactor=50
> </Proxy>
>
>
> ProxyPass / balancer://cluster/ stickysession=JSESSIONID
> ProxyPassReverse / balancer://cluster/
>
> I've bee looking to the mod_rewirte module, but I'm not sure how I could add the third server and only send the specific user agents to that server.
>
This can be done fairly easily using a rewritecond:
RewriteCond %{HTTP_USER_AGENT} /some/matching/regex/
RewriteRule / ajp://server3:8009/ [P]
HOWEVER, this cannot be done inside the context of your balancer -
unless you do all three this way.
So you lose the sessionID.
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
--
J.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org