You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by lightbulb432 <ve...@hotmail.com> on 2007/06/24 00:39:27 UTC

Port-based virtual hosting

Was just thinking about this, and am curious to know (though it's pretty
trivial)... Is there any functional difference between the two options - if
they're both even possible? Which would you go with?

- 1 Service element with 5 HTTP connectors (each on a different port) and
one Engine with 5 Hosts (<Host name="application.com:8080">, <Host
name="application.com:8081">, etc...)
<Service>
  <Connector/>
  <Connector/>
  <Connector/>
  <Connector/>
  <Connector/>
  <Engine>
     <Host/>
     <Host/>
     <Host/>
     <Host/>
     <Host/>
  </Engine>
</Service>

- 5 Service elements, each with 1 HTTP connector and one Engine with only 1
Host (i.e. the following repeated 5 times)
<Service>
  <Connector/>
  <Engine>
     <Host/>
  </Engine>
</Service>


I'm just trying to wrap my head around the server.xml file, and I believe
asking questions like this (though they may seem to be pretty pointless)
will help me understand better.

Thanks.
-- 
View this message in context: http://www.nabble.com/Port-based-virtual-hosting-tf3970665.html#a11270800
Sent from the Tomcat - User mailing list archive at Nabble.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: Port-based virtual hosting

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
> Subject: RE: Port-based virtual hosting
> 
> If you somehow have multiple contexts (within the same Host 
> or Service, or within different ones in your Tomcat instance)
> that point to the same WAR file or docBase, are there multiple
> "instances" of that web application running

Yes.  Each non-overridden explicit or implicit <Context> results in a
separate webapp, regardless of the location of the code in the file
system.  Since each webapp has its own classloader, the classes involved
are distinct.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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: Port-based virtual hosting

Posted by lightbulb432 <ve...@hotmail.com>.
The question's more of a general one to help me understand some elements in
server.xml. Maybe I'll start with this question first, though:

If you somehow have multiple contexts (within the same Host or Service, or
within different ones in your Tomcat instance) that point to the same WAR
file or docBase, are there multiple "instances" of that web application
running, or are the multiple entry points to that application (based on it
being specified in multiple hosts) really pointing to the same instance of
that webapp?

If this doesn't make sense, I can clarify. Thanks.



Caldarale, Charles R wrote:
> 
>> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
>> Subject: Port-based virtual hosting
>> 
>> Is there any functional difference between the two
>> options - if they're both even possible? Which would
>> you go with?
>> 
>> - 1 Service element with 5 HTTP connectors (each on a 
>> different port) and one Engine with 5 Hosts
>> (<Host name="application.com:8080">, <Host
>> name="application.com:8081">, etc...)
>> 
>> - 5 Service elements, each with 1 HTTP connector and one 
>> Engine with only 1 Host
> 
> Not sure I understand your requirements.  Are you trying to implement
> multiple virtual hosts that are segregated by port number rather than
> DNS name?
> 
> Your first option is not likely to work, since the port number is
> stripped off before comparison with the <Host> name is done.  (Also,
> since the <Host> name is used as a directory name in the underlying file
> system, the colon won't be allowed on many platforms.)
> 
> The first option would use less resources than the second one, but I
> think it would require that you write a <Valve> to forward each request
> to the proper <Host>.  I think the second one will work without any
> additional coding (but I haven't tried it).
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Port-based-virtual-hosting-tf3970665.html#a11281403
Sent from the Tomcat - User mailing list archive at Nabble.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: Port-based virtual hosting

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: lightbulb432 [mailto:veerukrishnan@hotmail.com] 
> Subject: Port-based virtual hosting
> 
> Is there any functional difference between the two
> options - if they're both even possible? Which would
> you go with?
> 
> - 1 Service element with 5 HTTP connectors (each on a 
> different port) and one Engine with 5 Hosts
> (<Host name="application.com:8080">, <Host
> name="application.com:8081">, etc...)
> 
> - 5 Service elements, each with 1 HTTP connector and one 
> Engine with only 1 Host

Not sure I understand your requirements.  Are you trying to implement
multiple virtual hosts that are segregated by port number rather than
DNS name?

Your first option is not likely to work, since the port number is
stripped off before comparison with the <Host> name is done.  (Also,
since the <Host> name is used as a directory name in the underlying file
system, the colon won't be allowed on many platforms.)

The first option would use less resources than the second one, but I
think it would require that you write a <Valve> to forward each request
to the proper <Host>.  I think the second one will work without any
additional coding (but I haven't tried it).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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