tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy <jer...@paribus.com>
Subject Using the balancer app to redirect. Well, trying to
Date Tue, 09 Jan 2007 16:01:02 GMT
Hi

Sorry if this is a bit of a dumb question, but I just wondered if anyone 
had any handy hints for the problem below:

I'm trying to set up a tomcat 5.0.28 instance (on Debian)  to achieve 
redirecting accesses to site1.company.com through to newsite1.org, using 
the balancer app. rather than apache webserver and the AJP connectors.

The easiest solution would of course be just to set up a DNS level 
redirect on all port-80 accesses by putting in an A-name record to point 
at newsite1.org, but the problem is that newsite1.org doesn't have a 
direct IP, and you can't put the alphanumeric address in the DNS.

THe canonical way of doing it appears to be to set up apache webserver 
as a front-end to tomcat and manage it using webapp connectors like AJP, 
but apart from being a total pain to organise (and memory-hungry in my 
setup as well), that introduces the webapp connectors, which have caused 
problems with the applications I am running in the past.

Sooo.. what I have tried to do instead is be sneaky, and set up an 
instance of the tomcat balancer app on the server (by copying the 
balancer app instance in tomcat/webapps/ and slightly modifying the 
rules in the /config subdir) which redirect any access to anything at 
company.com through to newsite1.org  
The machine that hosts the tomcat instance is set up in the DNS as the 
host for site1.company.com (in fact for all of company.com) and has a 
HOST container in server.xml, viz:

<Host name="company.com"
         debug="3"
         appBase="webapps"
         unpackWARs="true"
         autoDeploy="true">

        <Valve className="org.apache.catalina.valves.AccessLogValve"
          prefix="company_access_log." suffix=".txt"
          pattern="common"/>

         <Alias>site1.company.com</Alias>
    </Host>

and in <tomcat_root>/webapps there is an instance of the balancer app in 
a subdirectory called company.com, with a config file set up to perform 
the necessary redirection for all accesses to anything at company.com

This should work, as far as I can see.  however... although accesses to 
company.com/foobar get successfully redirected to newsite1.org/foobar, 
this setup doesn't forward at all when the root domain is entered - ie 
browsing to company.com or site1.company.com (with no antecedents) just 
results in a blank page.

I'm sure this used to work, and I've tried everything I can think of 
(including fiddling with the vhost definition in server.xml and the 
context fragment in webapps/company.com/company.com.xml) but I just 
can't make it respond to the root case.  Basically, what I'm trying to 
achieve is to get the root of the vhost instance defined in server.xml 
to call up the webapp at webapps/company1.com.   Which you wouldn't have 
thought was that hard - but apparently it is!

The REALLY irritating thing is that I've solved this problem once 
already using pretty much the same setup, but can;t seem to get it to 
work again!
Anyone have any clues or hints or ideas (apart from using apache 
webserver and the AJP setup)? I'd be very grateful if so!

Cheers

Jeremy


---------------------------------------------------------------------
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


Mime
View raw message