You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ilya Goldin <go...@pitt.edu> on 2001/11/01 02:00:17 UTC

RE: tomcat stand alone and multiple ips.

> > How can I attach an instance of tomcat to a specific ip?  
> Right now it 
> > monitors port 80 on all ips on the box.  Can I have one instance of 
> > tomcat host multiple 'virtual' sites or do I need
> > to run seperate instances of tomcat listening to different ips?
> 
> $TOMCAT_HOME\webapps\tomcat-docs\config\host.html
> 
> Looks like you can have mutiple virtual hosts for one 
> instance of Tomcat.

OK, fine -- but that's not what I want. I want exactly one virtual host
answering to exactly one domain name/ip request. If I have a machine
that binds to several different domain names and IPs, I only want Tomcat
to answer on ONE of those domain names. By default, it answers on all of
them.

In a way, I want a valve or filter to complement the existing Remote
Address Filter and Remote Host Filter. While those check the source of
the request, I want a filter that checks the explicit destination of the
request, so that my application does not launch if the request did not
explicitly specify its destination.
 
Is this functionality already available? Is there a workaround?

Thanks,
ig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: tomcat stand alone and multiple ips.

Posted by Prasanna Uppaladadium <pr...@kirusa.com>.
Hello.

I had asked exactly the same question before and I had requested that 
the documentation be updated for Tomcat 3.2.3 (in the 3.2.3 docs, the 
"inet" option isn't even mentioned). I strongly support the idea that 
this should be part of a FAQ.

Prasanna.

Ilya Goldin wrote:

>>That's actually possible as well (with Tomcat 4) -- it just 
>>takes a little more work.  Let's assume that you want the following:
>>
>>* Host a.mycompany.com answers only on IP address 10.0.0.1 port 8080
>>* Host b.mycompany.com answers only on IP address 10.0.0.2 port 8080
>>
> 
> <snip>
> 
> Craig, thank you! This is exactly what I was looking for. I had it all
> defined exactly as you describe, save for the all-important
> 
>>      <Connector port="8080" address="10.0.0.1" .../>
>>
> 
> Knowing the right answer, I went back and looked this up in the Tomcat
> documenation and sure enough, there it was.
> 
> This seems like a scenario that users might encounter frequently. I
> nominate this for a FAQ entry, should anyone be compiling those.
> 
> -ig
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


RE: tomcat stand alone and multiple ips.

Posted by Ilya Goldin <go...@pitt.edu>.
> That's actually possible as well (with Tomcat 4) -- it just 
> takes a little more work.  Let's assume that you want the following:
> 
> * Host a.mycompany.com answers only on IP address 10.0.0.1 port 8080
> * Host b.mycompany.com answers only on IP address 10.0.0.2 port 8080

<snip>

Craig, thank you! This is exactly what I was looking for. I had it all
defined exactly as you describe, save for the all-important
>       <Connector port="8080" address="10.0.0.1" .../>

Knowing the right answer, I went back and looked this up in the Tomcat
documenation and sure enough, there it was.

This seems like a scenario that users might encounter frequently. I
nominate this for a FAQ entry, should anyone be compiling those.

-ig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: tomcat stand alone and multiple ips.

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 31 Oct 2001, Ilya Goldin wrote:

> Date: Wed, 31 Oct 2001 20:00:17 -0500
> From: Ilya Goldin <go...@pitt.edu>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: 'Tomcat Users List' <to...@jakarta.apache.org>
> Subject: RE: tomcat stand alone and multiple ips.
>
> > > How can I attach an instance of tomcat to a specific ip?
> > Right now it
> > > monitors port 80 on all ips on the box.  Can I have one instance of
> > > tomcat host multiple 'virtual' sites or do I need
> > > to run seperate instances of tomcat listening to different ips?
> >
> > $TOMCAT_HOME\webapps\tomcat-docs\config\host.html
> >
> > Looks like you can have mutiple virtual hosts for one
> > instance of Tomcat.
>
> OK, fine -- but that's not what I want. I want exactly one virtual host
> answering to exactly one domain name/ip request. If I have a machine
> that binds to several different domain names and IPs, I only want Tomcat
> to answer on ONE of those domain names. By default, it answers on all of
> them.
>

That's actually possible as well (with Tomcat 4) -- it just takes a little
more work.  Let's assume that you want the following:

* Host a.mycompany.com answers only on IP address 10.0.0.1 port 8080
* Host b.mycompany.com answers only on IP address 10.0.0.2 port 8080

The key is that you have to set up a different <Service> for each
Connector.  A skeleton of your server.xml file would look like this:

  <Server ...>

    <Service name="Host A Service">
      <Connector port="8080" address="10.0.0.1" .../>
      <Engine name="Host A Engine" defaultHost="a.mycompany.com" ...>
        <Host name="a.mycompany.com" ...>
          <!-- <Context> entries for your webapps go here -->
        </Host>
      </Engine>
    </Service>

    <Service name="Host B Service">
      <Connector port="8080" address="10.0.0.2" .../>
      <Engine name="Host B Engine" defaultHost="b.mycompany.com" ...>
        <Host name="b.mycompany.com" ...>
          <!-- <Context> entries for your webapps go here -->
        </Host>
      </Engine>
    </Service>

</Server>

As variations on this theme, you can still have more than one <Connector>
within a service, as well as more than one name-based virtual host.  The
important part is that the connector only listens on the IP address that
you specify.

> In a way, I want a valve or filter to complement the existing Remote
> Address Filter and Remote Host Filter. While those check the source of
> the request, I want a filter that checks the explicit destination of the
> request, so that my application does not launch if the request did not
> explicitly specify its destination.
>

I'm not sure a filter would be sufficient -- if you want other
applications to be able to bind to other IP addresses with the same port
number, you definitely need to do something like the above.

> Is this functionality already available? Is there a workaround?
>

Does the multiple services approach outlined above do what you need?

> Thanks,
> ig
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>