You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by AD <st...@gmail.com> on 2008/10/14 04:17:49 UTC

mod_proxy_balancer

hello,
 If i have a tomcat app deployed at http://localhost:8080/myapp1/  and
http://localhost:8080/myapp2/ and i want 2 virtualhosts in apache to map "/"
to each one of these apps, is this possible?

Trying something like

<Proxy balancer://app1/>
    BalancerMember ajp://localhost:8009/app1/
    BalancerMember ajp://localhost:8009/app1/
</Proxy>

<Proxy balancer://tomcat_1_1/>
    BalancerMember ajp://localhost:8009/app2/
    BalancerMember ajp://localhost:8009/app2/
</Proxy>

Then in each virtualhost

HTTP Virtualhost 1:
ProxyPass / balancer://app1
ProxyPassReverse / balancer://app1

HTTP Virtualhost 2:
ProxyPass / balancer://app1
ProxyPassReverse / balancer://app1

but getting path errors all over.

 Thx
 Adam

Re: mod_proxy_balancer

Posted by Hassan Schroeder <ha...@gmail.com>.
Rats, sorry, copy/paste failure there, mail sent prematurely ...

Assuming port 8080 --

<Proxy balancer://whatever>
  BalancerMember http://localhost:8080/app1/
  BalancerMember http://localhost:8080/app2/
</Proxy>

And that would be configured the same for both virtual hosts.

  ProxyPass / balancer://whatever/
  ProxyPassReverse / balancer://whatever/

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_proxy_balancer

Posted by Hassan Schroeder <ha...@gmail.com>.
On Mon, Oct 13, 2008 at 7:17 PM, AD <st...@gmail.com> wrote:

>  If i have a tomcat app deployed at http://localhost:8080/myapp1/  and
> http://localhost:8080/myapp2/ and i want 2 virtualhosts in apache to map "/"
> to each one of these apps, is this possible?

Possible? Sure. Good idea? Probably not.

> Trying something like

Did your editor just drop into mode.new().generateRandomStuff()?

Do you want to use port 8080 (http) or 8009 (ajp)?

<Proxy balancer://whatever>
BalancerMember http://localhost:3000
</Proxy>


-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_proxy_balancer

Posted by Hassan Schroeder <ha...@gmail.com>.
On Tue, Oct 14, 2008 at 7:20 AM, AD <st...@gmail.com> wrote:

>  My issue is that the tomcat app, seems to want to redirect to
> /myapp1/some/file.html for a 302 (as an example) which is causing the
> issue.  is there a way around this  ?  This path gets back to apache which
> gets back to the end user who does not know how to process /myapp1/ in the
> browser.

Actually, no, the browser is just sending the request to your Apache
httpd, which doesn't know what to do with "/myapp1/".

So  you need to either use mod_rewrite or explicitly write your URLs
without the context (dicey and portability-limiting).

>  Any reason this is a "bad" idea ?

Are "app1" and "app2" identical? If not, "balancing" across them
makes zero sense.

And even if they *are* identical -- why would you "balance" across
two apps running in the same container?

The whole /point/ of balancing is to use multipleTomcat instances,
for load-balancing (and HA).

>From your original example, I can't begin to imagine your use case;
perhaps you can explain your goal?

H*
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_proxy_balancer

Posted by Rainer Jung <ra...@kippdata.de>.
AD schrieb:
> Hassan,
> 
>  Sorry about the copy/paste issue, i meant to use AJP
> 
>  My issue is that the tomcat app, seems to want to redirect to
> /myapp1/some/file.html for a 302 (as an example) which is causing the
> issue.  is there a way around this  ?  This path gets back to apache which
> gets back to the end user who does not know how to process /myapp1/ in the
> browser.
> 
>  Any reason this is a "bad" idea ?

The reverse directive shoudn't refer to the balancer-URL, but instead it
should contain the redirect URL your tomcat produces. Like:

ProxyPassReverse / http://mytomcat1:8009/myapp1/
ProxyPassReverse / http://mytomcat2:8009/myapp1/

and mytomcat1, mytomcat2 depend on what your Tomcat instances actually
send back as a redirect (Location header). In the case of forwarding via
 AJP instead of HTTP, Tomcat should automatically use server name and
port of your Apache, and only the context name should need to get fixed:

ProxyPassReverse / http://myapache/myapp1/

Regards,

Rainer

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: mod_proxy_balancer

Posted by AD <st...@gmail.com>.
Hassan,

 Sorry about the copy/paste issue, i meant to use AJP

 My issue is that the tomcat app, seems to want to redirect to
/myapp1/some/file.html for a 302 (as an example) which is causing the
issue.  is there a way around this  ?  This path gets back to apache which
gets back to the end user who does not know how to process /myapp1/ in the
browser.

 Any reason this is a "bad" idea ?

Thx

Adam

On Mon, Oct 13, 2008 at 10:17 PM, AD <st...@gmail.com> wrote:

> hello,
>  If i have a tomcat app deployed at http://localhost:8080/myapp1/  and
> http://localhost:8080/myapp2/ and i want 2 virtualhosts in apache to map
> "/" to each one of these apps, is this possible?
>
> Trying something like
>
> <Proxy balancer://app1/>
>     BalancerMember ajp://localhost:8009/app1/
>     BalancerMember ajp://localhost:8009/app1/
> </Proxy>
>
> <Proxy balancer://tomcat_1_1/>
>     BalancerMember ajp://localhost:8009/app2/
>     BalancerMember ajp://localhost:8009/app2/
> </Proxy>
>
> Then in each virtualhost
>
> HTTP Virtualhost 1:
> ProxyPass / balancer://app1
> ProxyPassReverse / balancer://app1
>
> HTTP Virtualhost 2:
> ProxyPass / balancer://app1
> ProxyPassReverse / balancer://app1
>
> but getting path errors all over.
>
>  Thx
>  Adam
>
>