You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kiran Badi <ki...@poonam.org> on 2015/09/04 05:31:56 UTC

Dynamically Create Subdomains - Tomcat 7x

Hi,

I need some help, I need to create subdomains dynamically, Is this possible
?

I have a site, www.mymainsite.com

on this main site, I drop the zipcode and city cookie and then I forward it
to front controller, and it's this front controller  which will point it to
city subdomain.

Can we create subdomains on the fly in tomcat ?

- Kiran

Re: Dynamically Create Subdomains - Tomcat 7x

Posted by Kiran Badi <ki...@poonam.org>.
Thanks Chris,

I have running tomcat with mysite hosted on it.I am trying to extend it and
get some extra mileage from my app.

I think I can go with hostname approach and see how it goes.

I have another query for which I will open another discussion.

Thanks everyone.

- Kiran


On Fri, Sep 4, 2015 at 1:49 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Kiran,
>
> On 9/4/15 12:25 PM, Kiran Badi wrote:
> > Let me try again Chris, I have this site www.mysite.com  ready with
> > some x amount of features in it
> >
> > Now I need to customize this site based on regions,states, and
> > cities.I will most likely go with cities.
> >
> > So I need my main site to redirect to city1.mysite.com .... etc
> > based on cookie value which I create on mysite.com(This is landing
> > page)
> >
> >
> >
> > what i need  is similar to as what  www.blogger.com or craiglist
> > does.Ex
> > http://www.quikr.com/all-cities,https://geo.craigslist.org/iso/us
> >
> > when we add a blog, it creates user.blogger.com and for another
> > user, it creates user1.blogger.com
> >
> > I am looking something similar ?
> >
> > Can this be done with just tomcat or I need to front end tomcat
> > with apache ?
> >
> > Is it required to spend extra money on DNS or creating different
> > folder/subdirectory for each region ?
> >
> > I have a single war file, and I intent to do this isolation
> > service layer/DB layer.
> >
> > Does this make sense ?
> >
> > I know its high level generic ask,but I really need some direction.
> > Maybe I am again vague,but I hope examples will give some direction
> > as what I am looking for.
>
> I agree with Chris Derham: if you have DNS set up to send *.mysite.com
> to your service, then all of those requests will go to your Tomcat
> server; it's up to you to decide what to do at that point.
>
> You *could* add an <Alias> (programmatically) for every single prefix
> you might think of to auto-generate, OR you could just use the default
> host for everything and then detect the hostname the user is using in
> order to customize some part of your application.
>
> I wouldn't bother trying to modify the configuration of the running
> Tomcat... instead, I'd just use the hostname to decide what to do once
> inside the application.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJV6dm/AAoJEBzwKT+lPKRYRkwQAJab8C/me3Uc46+w/8mSy+sH
> E25uNcbG5Inkz3X4cFOsjjPMbgPzMBFCY2rGaguO9nAfAt17gfAFyxwWoa+tI/HW
> i0US92kJwmlHWCTMgJKGBKQl7ca6BgwffzSvJuyfbdHHbLPeWH4CdgXSHCpgoX/8
> +gdi7Fawnq2elxvC2/xtWLSHfFBW7HkbJ6zKAD/U+zJPd2wh410sB0rZtm4yuFdt
> KYKAhOw1lzQ2zTKM2L7PWSLKjYfBtP08Mdi09f5u22yqGG7S63YOUkHZZXfg3+ui
> SowpRSuYe8KIfP+wgJxFxspyQ4xYVltaXeitZTgV1TWV760cGx3qbTYuAG6muf5e
> xd+QheLD2hWnbRRqLhplJAvlxKgKA8FmqZ8iFR3h9WNiXLePXpEYZlZpNWOSOaQE
> ju7lhP9BsNOWPidPv39i3YuOopnk5wyGaRivBwkgNLEzGwxmXkCEePnDf1kWumYQ
> 8T6l2OjSw7owkMtDJI97DPs8jSUIYJMCPbxR+PlNXiMs2SzZV+KIiLYPVNwU+IMe
> AjHYIOtgmH5G1nivu5tupjDutO4OY2gu66QDi7SzSFpZ0XvXAbml7asU3dwlppoq
> RldOZ01zEI8Z6yu0RRlxer1jPaDExZBkGIxin2ILdpxd562yWOUFbGYgBpdOjhI1
> ldoTCter5Kxa0U6CaS1l
> =USc4
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Dynamically Create Subdomains - Tomcat 7x

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Kiran,

On 9/4/15 12:25 PM, Kiran Badi wrote:
> Let me try again Chris, I have this site www.mysite.com  ready with
> some x amount of features in it
> 
> Now I need to customize this site based on regions,states, and
> cities.I will most likely go with cities.
> 
> So I need my main site to redirect to city1.mysite.com .... etc
> based on cookie value which I create on mysite.com(This is landing
> page)
> 
> 
> 
> what i need  is similar to as what  www.blogger.com or craiglist
> does.Ex 
> http://www.quikr.com/all-cities,https://geo.craigslist.org/iso/us
> 
> when we add a blog, it creates user.blogger.com and for another
> user, it creates user1.blogger.com
> 
> I am looking something similar ?
> 
> Can this be done with just tomcat or I need to front end tomcat
> with apache ?
> 
> Is it required to spend extra money on DNS or creating different 
> folder/subdirectory for each region ?
> 
> I have a single war file, and I intent to do this isolation
> service layer/DB layer.
> 
> Does this make sense ?
> 
> I know its high level generic ask,but I really need some direction.
> Maybe I am again vague,but I hope examples will give some direction
> as what I am looking for.

I agree with Chris Derham: if you have DNS set up to send *.mysite.com
to your service, then all of those requests will go to your Tomcat
server; it's up to you to decide what to do at that point.

You *could* add an <Alias> (programmatically) for every single prefix
you might think of to auto-generate, OR you could just use the default
host for everything and then detect the hostname the user is using in
order to customize some part of your application.

I wouldn't bother trying to modify the configuration of the running
Tomcat... instead, I'd just use the hostname to decide what to do once
inside the application.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJV6dm/AAoJEBzwKT+lPKRYRkwQAJab8C/me3Uc46+w/8mSy+sH
E25uNcbG5Inkz3X4cFOsjjPMbgPzMBFCY2rGaguO9nAfAt17gfAFyxwWoa+tI/HW
i0US92kJwmlHWCTMgJKGBKQl7ca6BgwffzSvJuyfbdHHbLPeWH4CdgXSHCpgoX/8
+gdi7Fawnq2elxvC2/xtWLSHfFBW7HkbJ6zKAD/U+zJPd2wh410sB0rZtm4yuFdt
KYKAhOw1lzQ2zTKM2L7PWSLKjYfBtP08Mdi09f5u22yqGG7S63YOUkHZZXfg3+ui
SowpRSuYe8KIfP+wgJxFxspyQ4xYVltaXeitZTgV1TWV760cGx3qbTYuAG6muf5e
xd+QheLD2hWnbRRqLhplJAvlxKgKA8FmqZ8iFR3h9WNiXLePXpEYZlZpNWOSOaQE
ju7lhP9BsNOWPidPv39i3YuOopnk5wyGaRivBwkgNLEzGwxmXkCEePnDf1kWumYQ
8T6l2OjSw7owkMtDJI97DPs8jSUIYJMCPbxR+PlNXiMs2SzZV+KIiLYPVNwU+IMe
AjHYIOtgmH5G1nivu5tupjDutO4OY2gu66QDi7SzSFpZ0XvXAbml7asU3dwlppoq
RldOZ01zEI8Z6yu0RRlxer1jPaDExZBkGIxin2ILdpxd562yWOUFbGYgBpdOjhI1
ldoTCter5Kxa0U6CaS1l
=USc4
-----END PGP SIGNATURE-----

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


Re: Dynamically Create Subdomains - Tomcat 7x

Posted by Kiran Badi <ki...@poonam.org>.
Let me try again Chris, I have this site www.mysite.com  ready with some x
amount of features in it

Now I need to customize this site based on regions,states, and cities.I
will most likely go with cities.

So I need my main site to redirect to city1.mysite.com .... etc based on
cookie value which I create on mysite.com(This is landing page)



what i need  is similar to as what  www.blogger.com or craiglist does.Ex
http://www.quikr.com/all-cities,https://geo.craigslist.org/iso/us

when we add a blog, it creates user.blogger.com and for another user, it
creates user1.blogger.com

I am looking something similar ?

Can this be done with just tomcat or I need to front end tomcat with apache
?

Is it required to spend extra money on DNS or creating different
folder/subdirectory for each region ?

I have a single war file, and I intent to do this isolation service
layer/DB layer.

Does this make sense ?

I know its high level generic ask,but I really need some direction. Maybe I
am again vague,but I hope examples will give some direction as what I am
looking for.

- Kiran





On Fri, Sep 4, 2015 at 9:03 AM, chris derham <ch...@derham.me.uk> wrote:

> > I need something like,
> >
> > My main landing page  www.mysite.com
> >
> > Subdomains I am looking for
> >
> > myfeature1.mysite.com
> >
> > myfeature2.mysite.com
> >
> > myfeature3.mysite.com
> >
> > etc
> >
> > myfeature is  a cookie value which comes from www.mysite.com(this is
> > landing page which drops myfeature cookie)..
> >
> > - Kiran
>
> so if you map *.mysite.com DNS name to a single server, it can do all of
> that.
>
> You are asking a very generic high level question, without providing
> details of what you have tried, and what isn't working. Hence you
> really need to open up more and explain. Can a single site handle all
> of these "features" or do you need isolation between them? Is this a
> "how can I setup DNS?" or a "how can I setup websesrvers against host
> names?" kind of question. It really is worded very openly so people
> will be hard pushed to help
>
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Dynamically Create Subdomains - Tomcat 7x

Posted by chris derham <ch...@derham.me.uk>.
> I need something like,
>
> My main landing page  www.mysite.com
>
> Subdomains I am looking for
>
> myfeature1.mysite.com
>
> myfeature2.mysite.com
>
> myfeature3.mysite.com
>
> etc
>
> myfeature is  a cookie value which comes from www.mysite.com(this is
> landing page which drops myfeature cookie)..
>
> - Kiran

so if you map *.mysite.com DNS name to a single server, it can do all of that.

You are asking a very generic high level question, without providing
details of what you have tried, and what isn't working. Hence you
really need to open up more and explain. Can a single site handle all
of these "features" or do you need isolation between them? Is this a
"how can I setup DNS?" or a "how can I setup websesrvers against host
names?" kind of question. It really is worded very openly so people
will be hard pushed to help

Chris

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


Re: Dynamically Create Subdomains - Tomcat 7x

Posted by Kiran Badi <ki...@poonam.org>.
Hi Andre,

I need something like,

My main landing page  www.mysite.com

Subdomains I am looking for

myfeature1.mysite.com

myfeature2.mysite.com

myfeature3.mysite.com

etc

myfeature is  a cookie value which comes from www.mysite.com(this is
landing page which drops myfeature cookie)..

- Kiran




On Fri, Sep 4, 2015 at 3:34 AM, André Warnier (tomcat) <aw...@ice-sa.com>
wrote:

> On 04.09.2015 05:31, Kiran Badi wrote:
>
>> Hi,
>>
>> I need some help, I need to create subdomains dynamically, Is this
>> possible
>> ?
>>
>> I have a site, www.mymainsite.com
>>
>> on this main site, I drop the zipcode and city cookie and then I forward
>> it
>> to front controller, and it's this front controller  which will point it
>> to
>> city subdomain.
>>
>> Can we create subdomains on the fly in tomcat ?
>>
>>
> Kiran,
> Can you try to re-phrase your question in terms which people without a
> crystal ball would understand ?
>
>
>
> Ce qui se conçoit bien s'énonce clairement - Et les mots pour le dire
> arrivent aisément.
> L'Art poétique (1674)
> Nicolas Boileau-Despréaux
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Dynamically Create Subdomains - Tomcat 7x

Posted by "André Warnier (tomcat)" <aw...@ice-sa.com>.
On 04.09.2015 05:31, Kiran Badi wrote:
> Hi,
>
> I need some help, I need to create subdomains dynamically, Is this possible
> ?
>
> I have a site, www.mymainsite.com
>
> on this main site, I drop the zipcode and city cookie and then I forward it
> to front controller, and it's this front controller  which will point it to
> city subdomain.
>
> Can we create subdomains on the fly in tomcat ?
>

Kiran,
Can you try to re-phrase your question in terms which people without a crystal ball would 
understand ?



Ce qui se conçoit bien s'énonce clairement - Et les mots pour le dire arrivent aisément.
L'Art poétique (1674)
Nicolas Boileau-Despréaux



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