You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Justin Maguire <ej...@gmail.com> on 2008/03/14 10:54:57 UTC
[users@httpd] Issue with mod_proxy when using Proxy balancer
Hello,
I am facing an issue when using mod_proxy to load balance to my backend
servers. Issue arises when the backend Weblogic server sends a a redirect
response back, which results in the backend server ip being passed on page
location.
I will explain further with an example.
Apache 2.2 Server: example.com
Backend Server: http://10.25.9.192:10010
I request http://example.com/ which is proxied to http://10.25.9.192:10010/
weblogic.com then access index.jsp which sends a redirect to
My index.jsp contains the following
"<% response.sendRedirect("page1.xhtml"); %>"
Now my browser is redirected to
http://10.25.9.192:10010/page1.xhtml<http://weblogic.com/page1.xhtml>instead
of being redirected with the apache proxy
http://example.com/page1.xhtml
Header add Set-Cookie "APACHEBALANCE=balancer.%{BALANCER_WORKER_ROUTE}e;
path=/;" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://ebsCluster>
BalancerMember http://10.25.9.192:10010 route=route1
BalancerMember http://10.25.9.193:10010 route=route2
ProxySet stickysession=APACHEBALANCE
</Proxy>
ProxyPass / balancer://ebsCluster/<http://balancer//ebsCluster/>
ProxyPassReverse /threestore balancer://ebsCluster/
If I use ProxyPass without the balancer I do not get the same problem
ProxyPass / http://10.25.9.192:10010/
ProxyPassReverse / http://10.25.9.192:10010/
With the above the browser is redirect to http://example.com/page1.xhtml
Any ideas or ways I could work around this?
Thanks!
Justin
RE: [users@httpd] Issue with mod_proxy when using Proxy balancer
Posted by Narendra Verma <na...@impetus.co.in>.
HI
Ya this problem comes when we use mod_proxy_http instead we should use
mod_proxy_ajp module.
How to :
This is your previous configuration
<Proxy balancer://ebsCluster>
BalancerMember http://10.25.9.192:10010 <http://10.25.9.192:10010/>
route=route1
BalancerMember http://10.25.9.193:10010 <http://10.25.9.193:10010/>
route=route2
ProxySet stickysession=APACHEBALANCE
</Proxy>
ProxyPass / balancer://ebsCluster/
<http://balancer/ebsCluster/>
ProxyPassReverse /threestore balancer://ebsCluster/
Just replace it by
Note here we are using ajp protocol for sending request from apache to
weblogic. So enable ajp protocol connector in you weblogic backend.
Then use following configuration :- (make sure mod_proxy_ajp must be loaded
in apache)
<Proxy balancer://ebsCluster>
BalancerMember ajp://10.25.9.192: <http://10.25.9.192:10010/>
<ajp_port> route=route1
BalancerMember ajp://10.25.9.193: <http://10.25.9.193:10010/>
<ajp_port> route=route2
ProxySet stickysession=APACHEBALANCE
</Proxy>
ProxyPass / balancer://ebsCluster/
<http://balancer/ebsCluster/>
ProxyPassReverse /threestore balancer://ebsCluster/
If you use ajp protocol instead of http for connecting apache to web logic
it would be less expensive. Because whatever header sent by ajp are shorter
then http.
But still you want to you http then please let me know other wise this is
better option.
Ok bye
Thanks
Narendra
-----Original Message-----
From: Justin Maguire [mailto:ejusmag@gmail.com]
Sent: Friday, March 14, 2008 3:25 PM
To: users@httpd.apache.org
Subject: [users@httpd] Issue with mod_proxy when using Proxy balancer
Hello,
I am facing an issue when using mod_proxy to load balance to my backend
servers. Issue arises when the backend Weblogic server sends a a redirect
response back, which results in the backend server ip being passed on page
location.
I will explain further with an example.
Apache 2.2 Server: example.com
Backend Server: http://10.25.9.192:10010 <http://10.25.9.192:10010/>
I request http://example.com/ which is proxied to http://10.25.9.192:10010/
weblogic.com then access index.jsp which sends a redirect to
My index.jsp contains the following
"<% response.sendRedirect("page1.xhtml"); %>"
Now my browser is redirected to http://10.25.9.192:10010
<http://10.25.9.192:10010/> /page1.xhtml <http://weblogic.com/page1.xhtml>
instead of being redirected with the apache proxy http://example.com/
<http://example.com/page1.xhtml> page1.xhtml
Header add Set-Cookie "APACHEBALANCE=balancer.%{BALANCER_WORKER_ROUTE}e;
path=/;" env=BALANCER_ROUTE_CHANGED
<Proxy balancer://ebsCluster>
BalancerMember http://10.25.9.192:10010 <http://10.25.9.192:10010/>
route=route1
BalancerMember http://10.25.9.193:10010 <http://10.25.9.193:10010/>
route=route2
ProxySet stickysession=APACHEBALANCE
</Proxy>
ProxyPass / balancer://ebsCluster/
<http://balancer/ebsCluster/>
ProxyPassReverse /threestore balancer://ebsCluster/
If I use ProxyPass without the balancer I do not get the same problem
ProxyPass / http://10.25.9.192:10010/
ProxyPassReverse / http://10.25.9.192:10010/
With the above the browser is redirect to http://example.com/
<http://example.com/page1.xhtml> page1.xhtml
Any ideas or ways I could work around this?
Thanks!
Justin