You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bart Ophelders <ba...@hotmail.com> on 2009/03/30 12:29:11 UTC

virtual hosts

Hi,

I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.

Thanks in advance!

-Bart Ophelders


Re: virtual hosts

Posted by Yassine <el...@users.sourceforge.net>.
so you mean in the same machine you will be hosting different domains

test1.example.com
test2.example.com
test3.example.com
...??

and you want to avoid having a conflict when someone is accessing
other domains example test1, test2, ... ?


actually if this is your case there is no problem at all, if you
create a domain for each of your known
domains/subdomain (test1.example.com,tes2.example.com,...) they will
be considered for requests
that targets them
so for example requests for test1.example.com --> proper domain
defined in server.xml and for anything
else undefined "*"
the defaultHost would be handling the requests

Yassine

On Mon, Mar 30, 2009 at 2:17 PM, Bart Ophelders
<ba...@hotmail.com> wrote:
>
> I 'm trying to set up an OpenID provider for testing purposes.
> Since we only have one machine, there are more applications running, and maybe there could be some conflicts. I'm not sure.
>
> -Bart
>
>> Date: Mon, 30 Mar 2009 14:07:38 +0200
>> Subject: Re: virtual hosts
>> From: elassad@users.sourceforge.net
>> To: users@tomcat.apache.org
>>
>> Hi Bart,
>>
>> I'm not aware of any other way to do it.
>> I only wanted to know whats wrong with setting that sub domain
>> (test.example.com) as the default host?
>> are we missing  some information that needs to be taken care of?
>>
>>
>> Yassine
>>
>>
>> On Mon, Mar 30, 2009 at 1:59 PM, Bart Ophelders
>> <ba...@hotmail.com> wrote:
>> >
>> > I don't like to put it as default, but if there is no other way..
>> >
>> > Thanks!
>> >
>> > -Bart
>> >
>> >> Date: Mon, 30 Mar 2009 12:39:42 +0100
>> >> From: p@pidster.com
>> >> To: users@tomcat.apache.org
>> >> Subject: Re: virtual hosts
>> >>
>> >> Bart Ophelders wrote:
>> >> > Thanks for the quick response!
>> >> >
>> >> > Isn't it possible to do something like this:
>> >> >
>> >> > <host name="*.test.example.com" appBase="webapps"/>
>> >>
>> >> Not quite like that.
>> >>
>> >> <Engine defaultHost="test.example.com">
>> >>
>> >>   <Host name="test.example.com" ... >
>> >>
>> >> </Engine>
>> >>
>> >>
>> >> Will result in all traffic that arrives at IPs specified in your
>> >> Connectors, but that does not conform to another Host/Alias definition
>> >> being delivered to the webapps of the defaultHost.
>> >>
>> >> p
>> >>
>> >>
>> >>
>> >> > -Bart Ophelders
>> >> >
>> >> >> Date: Mon, 30 Mar 2009 12:36:09 +0200
>> >> >> Subject: Re: virtual hosts
>> >> >> From: elassad@users.sourceforge.net
>> >> >> To: users@tomcat.apache.org
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> i hope i undertstood what you mean if so, look for the loadbalancer
>> >> >> application shipped with tomcat which does something similar.
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Mon, Mar 30, 2009 at 12:29 PM, Bart Ophelders
>> >> >> <ba...@hotmail.com> wrote:
>> >> >>> Hi,
>> >> >>>
>> >> >>> I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
>> >> >>>
>> >> >>> Thanks in advance!
>> >> >>>
>> >> >>> -Bart Ophelders
>> >> >>>
>> >> >>>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> --
>> >> >> Yassine Elassad
>> >> >> Bonn, Germany.
>> >> >> Fon : +49 228 97629355
>> >> >> Mobile : +49 157 74519666
>> >> >>
>> >> >> PEACE :
>> >> >> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> >> For additional commands, e-mail: users-help@tomcat.apache.org
>> >> >>
>> >> >
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>
>> >
>>
>>
>>
>> --
>> --
>> Yassine Elassad
>> Bonn, Germany.
>> Fon : +49 228 97629355
>> Mobile : +49 157 74519666
>>
>> PEACE :
>> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>



-- 
--
Yassine Elassad
Bonn, Germany.
Fon : +49 228 97629355
Mobile : +49 157 74519666

PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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


RE: virtual hosts

Posted by Bart Ophelders <ba...@hotmail.com>.
I 'm trying to set up an OpenID provider for testing purposes.
Since we only have one machine, there are more applications running, and maybe there could be some conflicts. I'm not sure.

-Bart

> Date: Mon, 30 Mar 2009 14:07:38 +0200
> Subject: Re: virtual hosts
> From: elassad@users.sourceforge.net
> To: users@tomcat.apache.org
> 
> Hi Bart,
> 
> I'm not aware of any other way to do it.
> I only wanted to know whats wrong with setting that sub domain
> (test.example.com) as the default host?
> are we missing  some information that needs to be taken care of?
> 
> 
> Yassine
> 
> 
> On Mon, Mar 30, 2009 at 1:59 PM, Bart Ophelders
> <ba...@hotmail.com> wrote:
> >
> > I don't like to put it as default, but if there is no other way..
> >
> > Thanks!
> >
> > -Bart
> >
> >> Date: Mon, 30 Mar 2009 12:39:42 +0100
> >> From: p@pidster.com
> >> To: users@tomcat.apache.org
> >> Subject: Re: virtual hosts
> >>
> >> Bart Ophelders wrote:
> >> > Thanks for the quick response!
> >> >
> >> > Isn't it possible to do something like this:
> >> >
> >> > <host name="*.test.example.com" appBase="webapps"/>
> >>
> >> Not quite like that.
> >>
> >> <Engine defaultHost="test.example.com">
> >>
> >>   <Host name="test.example.com" ... >
> >>
> >> </Engine>
> >>
> >>
> >> Will result in all traffic that arrives at IPs specified in your
> >> Connectors, but that does not conform to another Host/Alias definition
> >> being delivered to the webapps of the defaultHost.
> >>
> >> p
> >>
> >>
> >>
> >> > -Bart Ophelders
> >> >
> >> >> Date: Mon, 30 Mar 2009 12:36:09 +0200
> >> >> Subject: Re: virtual hosts
> >> >> From: elassad@users.sourceforge.net
> >> >> To: users@tomcat.apache.org
> >> >>
> >> >> Hi,
> >> >>
> >> >> i hope i undertstood what you mean if so, look for the loadbalancer
> >> >> application shipped with tomcat which does something similar.
> >> >>
> >> >>
> >> >>
> >> >> On Mon, Mar 30, 2009 at 12:29 PM, Bart Ophelders
> >> >> <ba...@hotmail.com> wrote:
> >> >>> Hi,
> >> >>>
> >> >>> I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
> >> >>>
> >> >>> Thanks in advance!
> >> >>>
> >> >>> -Bart Ophelders
> >> >>>
> >> >>>
> >> >>
> >> >>
> >> >> --
> >> >> --
> >> >> Yassine Elassad
> >> >> Bonn, Germany.
> >> >> Fon : +49 228 97629355
> >> >> Mobile : +49 157 74519666
> >> >>
> >> >> PEACE :
> >> >> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >> >>
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >
> 
> 
> 
> -- 
> --
> Yassine Elassad
> Bonn, Germany.
> Fon : +49 228 97629355
> Mobile : +49 157 74519666
> 
> PEACE :
> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

Re: virtual hosts

Posted by Yassine <el...@users.sourceforge.net>.
Hi Bart,

I'm not aware of any other way to do it.
I only wanted to know whats wrong with setting that sub domain
(test.example.com) as the default host?
are we missing  some information that needs to be taken care of?


Yassine


On Mon, Mar 30, 2009 at 1:59 PM, Bart Ophelders
<ba...@hotmail.com> wrote:
>
> I don't like to put it as default, but if there is no other way..
>
> Thanks!
>
> -Bart
>
>> Date: Mon, 30 Mar 2009 12:39:42 +0100
>> From: p@pidster.com
>> To: users@tomcat.apache.org
>> Subject: Re: virtual hosts
>>
>> Bart Ophelders wrote:
>> > Thanks for the quick response!
>> >
>> > Isn't it possible to do something like this:
>> >
>> > <host name="*.test.example.com" appBase="webapps"/>
>>
>> Not quite like that.
>>
>> <Engine defaultHost="test.example.com">
>>
>>   <Host name="test.example.com" ... >
>>
>> </Engine>
>>
>>
>> Will result in all traffic that arrives at IPs specified in your
>> Connectors, but that does not conform to another Host/Alias definition
>> being delivered to the webapps of the defaultHost.
>>
>> p
>>
>>
>>
>> > -Bart Ophelders
>> >
>> >> Date: Mon, 30 Mar 2009 12:36:09 +0200
>> >> Subject: Re: virtual hosts
>> >> From: elassad@users.sourceforge.net
>> >> To: users@tomcat.apache.org
>> >>
>> >> Hi,
>> >>
>> >> i hope i undertstood what you mean if so, look for the loadbalancer
>> >> application shipped with tomcat which does something similar.
>> >>
>> >>
>> >>
>> >> On Mon, Mar 30, 2009 at 12:29 PM, Bart Ophelders
>> >> <ba...@hotmail.com> wrote:
>> >>> Hi,
>> >>>
>> >>> I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
>> >>>
>> >>> Thanks in advance!
>> >>>
>> >>> -Bart Ophelders
>> >>>
>> >>>
>> >>
>> >>
>> >> --
>> >> --
>> >> Yassine Elassad
>> >> Bonn, Germany.
>> >> Fon : +49 228 97629355
>> >> Mobile : +49 157 74519666
>> >>
>> >> PEACE :
>> >> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> >> For additional commands, e-mail: users-help@tomcat.apache.org
>> >>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>



-- 
--
Yassine Elassad
Bonn, Germany.
Fon : +49 228 97629355
Mobile : +49 157 74519666

PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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


RE: virtual hosts

Posted by Bart Ophelders <ba...@hotmail.com>.
I don't like to put it as default, but if there is no other way..

Thanks!

-Bart

> Date: Mon, 30 Mar 2009 12:39:42 +0100
> From: p@pidster.com
> To: users@tomcat.apache.org
> Subject: Re: virtual hosts
> 
> Bart Ophelders wrote:
> > Thanks for the quick response!
> > 
> > Isn't it possible to do something like this:
> > 
> > <host name="*.test.example.com" appBase="webapps"/>
> 
> Not quite like that.
> 
> <Engine defaultHost="test.example.com">
> 
>   <Host name="test.example.com" ... >
> 
> </Engine>
> 
> 
> Will result in all traffic that arrives at IPs specified in your
> Connectors, but that does not conform to another Host/Alias definition
> being delivered to the webapps of the defaultHost.
> 
> p
> 
> 
> 
> > -Bart Ophelders
> > 
> >> Date: Mon, 30 Mar 2009 12:36:09 +0200
> >> Subject: Re: virtual hosts
> >> From: elassad@users.sourceforge.net
> >> To: users@tomcat.apache.org
> >>
> >> Hi,
> >>
> >> i hope i undertstood what you mean if so, look for the loadbalancer
> >> application shipped with tomcat which does something similar.
> >>
> >>
> >>
> >> On Mon, Mar 30, 2009 at 12:29 PM, Bart Ophelders
> >> <ba...@hotmail.com> wrote:
> >>> Hi,
> >>>
> >>> I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
> >>>
> >>> Thanks in advance!
> >>>
> >>> -Bart Ophelders
> >>>
> >>>
> >>
> >>
> >> -- 
> >> --
> >> Yassine Elassad
> >> Bonn, Germany.
> >> Fon : +49 228 97629355
> >> Mobile : +49 157 74519666
> >>
> >> PEACE :
> >> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

Re: virtual hosts

Posted by Pid <p...@pidster.com>.
Bart Ophelders wrote:
> Thanks for the quick response!
> 
> Isn't it possible to do something like this:
> 
> <host name="*.test.example.com" appBase="webapps"/>

Not quite like that.

<Engine defaultHost="test.example.com">

  <Host name="test.example.com" ... >

</Engine>


Will result in all traffic that arrives at IPs specified in your
Connectors, but that does not conform to another Host/Alias definition
being delivered to the webapps of the defaultHost.

p



> -Bart Ophelders
> 
>> Date: Mon, 30 Mar 2009 12:36:09 +0200
>> Subject: Re: virtual hosts
>> From: elassad@users.sourceforge.net
>> To: users@tomcat.apache.org
>>
>> Hi,
>>
>> i hope i undertstood what you mean if so, look for the loadbalancer
>> application shipped with tomcat which does something similar.
>>
>>
>>
>> On Mon, Mar 30, 2009 at 12:29 PM, Bart Ophelders
>> <ba...@hotmail.com> wrote:
>>> Hi,
>>>
>>> I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
>>>
>>> Thanks in advance!
>>>
>>> -Bart Ophelders
>>>
>>>
>>
>>
>> -- 
>> --
>> Yassine Elassad
>> Bonn, Germany.
>> Fon : +49 228 97629355
>> Mobile : +49 157 74519666
>>
>> PEACE :
>> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
> 


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


RE: virtual hosts

Posted by Bart Ophelders <ba...@hotmail.com>.
Thanks for the quick response!

Isn't it possible to do something like this:

<host name="*.test.example.com" appBase="webapps"/>

-Bart Ophelders

> Date: Mon, 30 Mar 2009 12:36:09 +0200
> Subject: Re: virtual hosts
> From: elassad@users.sourceforge.net
> To: users@tomcat.apache.org
> 
> Hi,
> 
> i hope i undertstood what you mean if so, look for the loadbalancer
> application shipped with tomcat which does something similar.
> 
> 
> 
> On Mon, Mar 30, 2009 at 12:29 PM, Bart Ophelders
> <ba...@hotmail.com> wrote:
> >
> > Hi,
> >
> > I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
> >
> > Thanks in advance!
> >
> > -Bart Ophelders
> >
> >
> 
> 
> 
> -- 
> --
> Yassine Elassad
> Bonn, Germany.
> Fon : +49 228 97629355
> Mobile : +49 157 74519666
> 
> PEACE :
> ( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

Re: virtual hosts

Posted by Yassine <el...@users.sourceforge.net>.
Hi,

i hope i undertstood what you mean if so, look for the loadbalancer
application shipped with tomcat which does something similar.



On Mon, Mar 30, 2009 at 12:29 PM, Bart Ophelders
<ba...@hotmail.com> wrote:
>
> Hi,
>
> I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
>
> Thanks in advance!
>
> -Bart Ophelders
>
>



-- 
--
Yassine Elassad
Bonn, Germany.
Fon : +49 228 97629355
Mobile : +49 157 74519666

PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.

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


Re: virtual hosts

Posted by André Warnier <aw...@ice-sa.com>.
Bart Ophelders wrote:
> Sorry if I was somewhat unclear.
> 
> What I would like to accomplish is the following:
> 
> If someone types start.test.example.com it should refer to a certain page.
> If someone types hello.test.example.com it should refer to the same page.
> I would like the user to be able to type anything before the test.example.com and tomcat still accepts it and refers to the correct page (<anything>.test.example.com)
> 
The first thing you need to understand is that there are 2 steps :
1) when the user types "xxx.test.example.com", /his/ DNS resolver needs 
to resolve that to the IP address of your server.  Otherwise, your 
Tomcat will never even receive and see those requests.
2) /then/ you can start thinking about how Tomcat should process the 
requests that it receives.
Really make sure you understand (1) before you start with (2).

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


RE: virtual hosts

Posted by Bart Ophelders <ba...@hotmail.com>.
Sorry if I was somewhat unclear.

What I would like to accomplish is the following:

If someone types start.test.example.com it should refer to a certain page.
If someone types hello.test.example.com it should refer to the same page.
I would like the user to be able to type anything before the test.example.com and tomcat still accepts it and refers to the correct page (<anything>.test.example.com)

I know I can define multiple hosts, but it is not possible to know all the possibilities.
So I was hoping the '*' wildcard would work (put "*.test.example.com" as host name in server.xml), but it doesn't.

Tomcat 6
Java 1.6
CentOS 5.2

Thanks,

-Bart



> Date: Mon, 30 Mar 2009 12:04:56 +0100
> From: p@pidster.com
> To: users@tomcat.apache.org
> Subject: Re: virtual hosts
> 
> Bart Ophelders wrote:
> > Hi,
> > 
> > I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.
> 
> It's not clear what you mean.  URLs normally *start* with a domain,
> rather than end with it.
> 
> If you mean can I assign "*.domain.com" to a specific webapp, the answer
> is yes - by defining the default host for a service.
> 
> Perhaps you can elaborate?
> 
> p
> 
> 
> P.S. Java version, Tomcast version, OS etc?
> 
> 
> 
> 
> > Thanks in advance!
> > 
> > -Bart Ophelders
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

Re: virtual hosts

Posted by Pid <p...@pidster.com>.
Bart Ophelders wrote:
> Hi,
> 
> I would like to know if it is possible to let tomcat redirect ANY url ending with for example test.example.com to a certain webapp.

It's not clear what you mean.  URLs normally *start* with a domain,
rather than end with it.

If you mean can I assign "*.domain.com" to a specific webapp, the answer
is yes - by defining the default host for a service.

Perhaps you can elaborate?

p


P.S. Java version, Tomcast version, OS etc?




> Thanks in advance!
> 
> -Bart Ophelders
> 
> 


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