You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nathan Hook <ho...@hotmail.com> on 2007/05/15 20:28:07 UTC

Dynamic URIs Using one Context

We've been given a difficult problem to solve and I'm hoping that some 
help/insight is available on this mailing list.

We are an Application Service Provider (ASP) that has numerous clients with 
the number of clients increasing rapidly.  All our clients use the same 
application but each client needs/wants a distinguishing element in the url 
to identify them to their users.

Here is our current setup:

Apache 2.2 with mod_jk sending requests to Tomcat 5.5.  Struts 1.3.8 is our 
current web framework.

In our httpd.conf we have a different domain name for each client:

<VirtualHost *:80>
    ServerName <client name 1>.<server name>.com
    DocumentRoot <some directory>/<client name 1>.<server name>.com
</VirtualHost>

<VirtualHost *:80>
    ServerName <client name 2>.<server name>.com
    DocumentRoot <some directory>/<client name 2>.<server name>.com
</VirtualHost>

Then in our server.xml config file for Tomcat we only declare one Host 
element with a Context that has many Alias':

<Host name="<client name 1>.<server name>.com" appBase="webapps">
    <Context path="/app" >
    </Context>
    <Alias><client name 2>.<server name>.com</Alias>
    <Alias><client name 3>.<server name>.com</Alias>
    ...etc for each of our clients...
</Host>

So, what is the problem?  Well, when we add a new customer we have to edit 
the httpd.conf, the server.xml, restart both applications, and add the new 
<customer>.<server name>.com to DNS (Usually, we have to wait until late 
into the evening to do these tasks).  Our Client Services team want the 
ability to add customers without having to wait until we can restart our 
servers.

Is it possible to do the following with an Apache 2.2 and Tomcat 5.5 
combination while having only ONE instance of the application only once 
loaded in Tomcat?  (Meaning we do NOT want the application loaded by Tomcat 
x times, with x being the number of clients we have.)

<base name>.<server name>.com/<client name 1>/app
<base name>.<server name>.com/<client name 2>/app
<base name>.<server name>.com/<client name 3>/app

I'm not really the best with how the Context attribute works outside of 
having it placed in the server.xml.  I've tried reading the documentation on 
Contexts at:
http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html
But, I find what is explained a tad bit confusing.

Here is one thread from the archives that explained our problem pretty well, 
but there never really was an answer on how to accomplish the task except 
"you're getting the right behavior with a 400 response":
http://marc.info/?l=tomcat-user&m=115602705505727&w=2

Finally, through some other research, it seems as though someone was trying 
to use mod_vhost_alias to accomplish the same thing.

Any thoughts or suggestions are welcome.

Thank you for your time.

_________________________________________________________________
Make every IM count. Download Messenger and join the i’m Initiative now. 
It’s free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07


---------------------------------------------------------------------
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: Dynamic URIs Using one Context

Posted by Pid <p...@pidster.com>.
Hassan Schroeder wrote:
> On 5/16/07, Nathan Hook <ho...@hotmail.com> wrote:
> 
>> Would changing the ServerName attribute to <server name>.com allow 
>> Apache to
>> respond to all requests sent to the server that are subdomains?
> 
> I'm not sure ServerName is even *required*, in which case you'd
> simply be processing any request to *:80 (presumably passing it
> back to Tomcat). But easy enough to test, I'd think.
> 
>> Here is another question involving Apache, but this time with SSL.  
>> Would a
>> wildcard certificate be able to work in the same fashion as the above
>> configuration?  As of right now we have to have a NEW IP address for
>> everyone of our clients
> 
> gack. stop right there -- that's the whole point of wildcard certs, to
> end such madness by handling "*.example.com" on 1 IP :-)
> 
> I implemented just such an httpd/Tomcat setup for a client last year.
> So it's definitely a valid approach.

On one site I'm using a wildcard cert with Apache/Tomcat right now to 
support many sub-domains & it works like a dream.

Only needed to set the default hostname in the Engine.

p


> HTH,


Re: Dynamic URIs Using one Context

Posted by Nathan Hook <ho...@hotmail.com>.
Excellent.

This might sound a tad bit on the dense side, but are there any links to 
examples of how to use wildcard certificates with IP address mapping for 
both Apache and Tomcat?

I've tried to find some examples on the web, but I am unable to find 
anything with substance.

Thank you again for your time and ideas.


----Original Message Follows----

>Would changing the ServerName attribute to <server name>.com allow Apache 
>to
>respond to all requests sent to the server that are subdomains?

I'm not sure ServerName is even *required*, in which case you'd
simply be processing any request to *:80 (presumably passing it
back to Tomcat). But easy enough to test, I'd think.

>Here is another question involving Apache, but this time with SSL.  Would a
>wildcard certificate be able to work in the same fashion as the above
>configuration?  As of right now we have to have a NEW IP address for
>everyone of our clients

gack. stop right there -- that's the whole point of wildcard certs, to
end such madness by handling "*.example.com" on 1 IP :-)

I implemented just such an httpd/Tomcat setup for a client last year.
So it's definitely a valid approach.

HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

_________________________________________________________________
More photos, more messages, more storage—get 2GB with Windows Live Hotmail. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507


---------------------------------------------------------------------
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: Dynamic URIs Using one Context

Posted by Hassan Schroeder <ha...@gmail.com>.
On 5/16/07, Nathan Hook <ho...@hotmail.com> wrote:

> Would changing the ServerName attribute to <server name>.com allow Apache to
> respond to all requests sent to the server that are subdomains?

I'm not sure ServerName is even *required*, in which case you'd
simply be processing any request to *:80 (presumably passing it
back to Tomcat). But easy enough to test, I'd think.

> Here is another question involving Apache, but this time with SSL.  Would a
> wildcard certificate be able to work in the same fashion as the above
> configuration?  As of right now we have to have a NEW IP address for
> everyone of our clients

gack. stop right there -- that's the whole point of wildcard certs, to
end such madness by handling "*.example.com" on 1 IP :-)

I implemented just such an httpd/Tomcat setup for a client last year.
So it's definitely a valid approach.

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.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: Dynamic URIs Using one Context

Posted by Nathan Hook <ho...@hotmail.com>.
Thanks to everyone for all the excellent and interesting replies.  They (the 
replies) have really gotten the creative thought process going.

>From the responses so far.  It sounds like messing with the uri is 
problematic.


Now, I know this is the Tomcat mailing list, but everyones ideas have 
brought up some interesting questions on configuring Apache.

So, currently we have a different entry for everyone of our clients in our 
httpd.conf file:

<VirtualHost *:80>
   ServerName <client name 1>.<server name>.com
   DocumentRoot <some directory>/<client name 1>.<server name>.com
</VirtualHost>

<VirtualHost *:80>
   ServerName <client name 2>.<server name>.com
   DocumentRoot <some directory>/<client name 1>.<server name>.com
</VirtualHost>

Would changing the ServerName attribute to <server name>.com allow Apache to 
respond to all requests sent to the server that are subdomains?  So, if the 
only entry in our httpd.conf file is:

<VirtualHost *:80>
   ServerName <server name>.com
#   DocumentRoot <some directory>/<client name 1>.<server name>.com
</VirtualHost>

Would Apache handle requests for the following domain names:

<client 1>.<server name>.com
<client 2>.<server name>.com
<client 3>.<server name>.com
etc...


Here is another question involving Apache, but this time with SSL.  Would a 
wildcard certificate be able to work in the same fashion as the above 
configuration?  As of right now we have to have a NEW IP address for 
everyone of our clients that request to have a secure site.  Which is a 
major pain.  We have to request a new IP address from our ISP, have the 
hardware load balancer configured for the new IP adress, add new internal IP 
address to each of our load balanced servers, and then finally edit all our 
httpd.conf/server.xml files.

Can we do the following in our ssl.conf file and not receive the "Security 
Domain Mismatch Error" dialog box?

<VirtualHost <generic ip address>:443>

     DocumentRoot "/www/htdocs/<server name>.com"
     Alias /base/ "/www/htdocs/"

     ServerName <server name>.com:443
     ServerAdmin webmaster@<server name>.com
     ErrorLog /logs/httpd/ssl_error_log
     TransferLog /logs/httpd/ssl_access_log

     #   SSL Engine Switch:
     #   Enable/Disable SSL for this virtual host.
     SSLEngine on

     #   SSL Cipher Suite:
     #   List the ciphers that the client is permitted to negotiate.
     #   See the mod_ssl documentation for a complete list.
     SSLCipherSuite 
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

     SSLCertificateFile /www/certs/*.<server name>.com.crt
     SSLCertificateKeyFile /www/certs/*.<server name>.com.key

     <Files ~ "\.(cgi|shtml|phtml|php3?)$">
         SSLOptions +StdEnvVars
     </Files>
     <Directory "/usr/local/apache2/cgi-bin">
         SSLOptions +StdEnvVars
     </Directory>

     SetEnvIf User-Agent ".*MSIE.*" \
              nokeepalive ssl-unclean-shutdown \
              downgrade-1.0 force-response-1.0

     CustomLog /usr/local/apache2/logs/ssl_request_log \
               "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

Or will we still require one distinct IP address per sub domain?


We've changed the Host directive in our Tomcat server.xml from:

<Host name="<client name 1>.<server name>.com" appBase="webapps">
   <Context path="/app" >
   </Context>
   <Alias><client name 2>.<server name>.com</Alias>
   <Alias><client name 3>.<server name>.com</Alias>
   ...etc for each of our clients...
</Host>

to the following:

<Host name="localhost" appBase="webapps">
  <Context path="/app" >
  </Context>
</Host>

And Tomcat is working great.


Finally, for the questions about the static content.  We're actually going 
to have the application managing the content, because in most cases (except 
for logs and some pictures) the users must be logged into the application to 
have access to any content.  We will most like be able to use a dynamically 
created directory structure for this purpose.


Thanks again for everyones replies and time.




----Original Message Follows----
From: "Johnny Kewl" <jo...@kewlstuff.co.za>
Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Subject: Re: Dynamic URIs Using one Context
Date: Wed, 16 May 2007 11:24:31 +0200


These sort of things.... http://www.mycompany.com/~craigmcc/index.htm
Yes.... nice I think for static sites and letting people ftp in... normal 
kinda thing a sp
provides.... but I think these guys are trying to cater for power tomcat 
users.

Probably provide things like MySQL and Postgresql facilities etc... and then 
I think as
you said... the static type stuff will break down... still, also nice for 
the user that can make
an html file but doesnt know wot tomcat is... why not.... may be nice for a 
user that has several web apps... can have an index page to all his 
webapps... maybe... but sp will probably have a page that does that on their 
ROOT app...

Company A

LinkToEmployeeWebApp
LinkToFreeServicesWebApp

Company B

etc etc

if anything to promote the SP and get it to pick up in google.... more hits 
etc....

.... fascinating stuff coz its as much about the biz as it is about 
tomcat...

----- Original Message ----- From: "Raghupathy, Gurumoorthy" 
<Gu...@nielsen.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, May 16, 2007 10:53 AM
Subject: RE: Dynamic URIs Using one Context


You can use
http://httpd.apache.org/docs/2.0/mod/mod_userdir.html and
http://tomcat.apache.org/tomcat-5.5-doc/config/host.html  ( User Web App
) in conjunction with a mod_rewrite and proxy ...... Not simple but
achievable .... :)


Regards
Guru



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

_________________________________________________________________
Like the way Microsoft Office Outlook works? You’ll love Windows Live 
Hotmail. 
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_outlook_0507


---------------------------------------------------------------------
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: Dynamic URIs Using one Context

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
These sort of things.... http://www.mycompany.com/~craigmcc/index.htm
Yes.... nice I think for static sites and letting people ftp in... normal 
kinda thing a sp
provides.... but I think these guys are trying to cater for power tomcat 
users.

Probably provide things like MySQL and Postgresql facilities etc... and then 
I think as
you said... the static type stuff will break down... still, also nice for 
the user that can make
an html file but doesnt know wot tomcat is... why not.... may be nice for a 
user that has several web apps... can have an index page to all his 
webapps... maybe... but sp will probably have a page that does that on their 
ROOT app...

Company A

LinkToEmployeeWebApp
LinkToFreeServicesWebApp

Company B

etc etc

if anything to promote the SP and get it to pick up in google.... more hits 
etc....

.... fascinating stuff coz its as much about the biz as it is about 
tomcat...

----- Original Message ----- 
From: "Raghupathy, Gurumoorthy" <Gu...@nielsen.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Wednesday, May 16, 2007 10:53 AM
Subject: RE: Dynamic URIs Using one Context


You can use
http://httpd.apache.org/docs/2.0/mod/mod_userdir.html and
http://tomcat.apache.org/tomcat-5.5-doc/config/host.html  ( User Web App
) in conjunction with a mod_rewrite and proxy ...... Not simple but
achievable .... :)


Regards
Guru



---------------------------------------------------------------------
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: Dynamic URIs Using one Context

Posted by "Raghupathy, Gurumoorthy" <Gu...@nielsen.com>.
You can use 
http://httpd.apache.org/docs/2.0/mod/mod_userdir.html and
http://tomcat.apache.org/tomcat-5.5-doc/config/host.html  ( User Web App
) in conjunction with a mod_rewrite and proxy ...... Not simple but
achievable .... :)


Regards
Guru

-----Original Message-----
From: Johnny Kewl [mailto:john@kewlstuff.co.za] 
Sent: 16 May 2007 08:43
To: Tomcat Users List
Subject: Re: Dynamic URIs Using one Context


Interesting question....  this is wot I would do.... try!
The basic thing I would use Apache Httpd for it to.... direct via
Virtual 
hosting and the worker file... domain names to various tomcat instances.
eg you can have 2 tomcat instances on a machine and tomcat spread across

many machines.

So domain names become things like Games.ServiceProvider.Net 
Accounts.ServiceProvider.Net   Webs.ServiceProvider.Net 
Free.ServiceProvider.Net

..... Context paths as far as I am concerned dont work... nor do I (you)

really want them....
It works on the web-app name and the uri mapping in web.xml.... or the 
web-app name and the path to the jsp..... forget about context paths.
It makes more sense outside of context paths, anyway...

So if a client writes an app    the uri will be
AssignedMachine/WebAppName/servletname
AssignedMachine/WebAppName/pathto.Jsp

etc...

In theory you can mess with the relative URI.... but in practice you
cant...
For example if you just change the webappname of the WAR... you will see

that uri also changes... and tomcat does the right thing with the
context 
paths (automatically!).
If you change the path to a jsp.... it will change the uri.
If you change the servlet mapping in web.xml you can put the servlet 
anywhere..... eg 
AssignedMachine/WebAppName/Some/more/stuff/in/servlet/mapping
etc etc....

BUT..... if you mess with this and even if you wanted to and could
override 
the context paths..... it will probably break the web-app 8 out of 10
times 
because programmers often hardcode paths inside their apps.... or have
used 
relative contexts that they expect to be there.

Point is.... if you forget about the users name in the uri.... life gets

easy... you will be dropping web-apps into a tomcat web-app... and going
for 
a coffee break.
Sometimes 2 users will have the same web app name.... you dont change 
it..... thats why you got multiple tomcat instances. Funstuff1.SP.net
etc.
Sometimes the user will want the root of the domain.... and his own
domain 
name.... that requires a restart of the system.... because you going to
use 
apache to map that 2  the TomcatsInstancesWithOwnDomainNames.... and
each 
tomcat will Map via the hosts section to that users own webapp
location....
ie if a user wants a domain name... they get their very own tomcat
(web-app 
location)... and they can use ROOT.... ie they own that domain.
Own domain name users will need a restart... so you try isolate that 
system... own domain users pay more..... but they got their own tomcat.

Keeping track of users..... spreadsheets.... ie webappx belongs to userx
Domainer's.... a good question now will be.... can the tomcat manager be

used to install web-app remotely.... only in one <host docbase> section
and 
not the others..... if so its great.... once setup... own domainers...
do 
their own thing.

Other thing is if a user... an own domainer... ever wanted load 
balancing.... its easy to provide....

If you want to get it to what you suggesting.... just tell the users
that 
their webapp name must be their username.... thing is, I think you will
find 
thats the last thing most people want in thier uri..... 
Accounts.SP.net/JohnnyKewl/InvoiceSystem/     ..... yuk!

Something like that..... nice interesting project..... have fun....


----- Original Message ----- 
From: "Nathan Hook" <ho...@hotmail.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, May 15, 2007 8:28 PM
Subject: Dynamic URIs Using one Context


> We've been given a difficult problem to solve and I'm hoping that some

> help/insight is available on this mailing list.
>
> We are an Application Service Provider (ASP) that has numerous clients

> with the number of clients increasing rapidly.  All our clients use
the 
> same application but each client needs/wants a distinguishing element
in 
> the url to identify them to their users.
>
> Here is our current setup:
>
> Apache 2.2 with mod_jk sending requests to Tomcat 5.5.  Struts 1.3.8
is 
> our current web framework.
>
> In our httpd.conf we have a different domain name for each client:
>
> <VirtualHost *:80>
>    ServerName <client name 1>.<server name>.com
>    DocumentRoot <some directory>/<client name 1>.<server name>.com
> </VirtualHost>
>
> <VirtualHost *:80>
>    ServerName <client name 2>.<server name>.com
>    DocumentRoot <some directory>/<client name 2>.<server name>.com
> </VirtualHost>
>
> Then in our server.xml config file for Tomcat we only declare one Host

> element with a Context that has many Alias':
>
> <Host name="<client name 1>.<server name>.com" appBase="webapps">
>    <Context path="/app" >
>    </Context>
>    <Alias><client name 2>.<server name>.com</Alias>
>    <Alias><client name 3>.<server name>.com</Alias>
>    ...etc for each of our clients...
> </Host>
>
> So, what is the problem?  Well, when we add a new customer we have to
edit 
> the httpd.conf, the server.xml, restart both applications, and add the
new 
> <customer>.<server name>.com to DNS (Usually, we have to wait until
late 
> into the evening to do these tasks).  Our Client Services team want
the 
> ability to add customers without having to wait until we can restart
our 
> servers.
>
> Is it possible to do the following with an Apache 2.2 and Tomcat 5.5 
> combination while having only ONE instance of the application only
once 
> loaded in Tomcat?  (Meaning we do NOT want the application loaded by 
> Tomcat x times, with x being the number of clients we have.)
>
> <base name>.<server name>.com/<client name 1>/app
> <base name>.<server name>.com/<client name 2>/app
> <base name>.<server name>.com/<client name 3>/app
>
> I'm not really the best with how the Context attribute works outside
of 
> having it placed in the server.xml.  I've tried reading the
documentation 
> on Contexts at:
> http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html
> But, I find what is explained a tad bit confusing.
>
> Here is one thread from the archives that explained our problem pretty

> well, but there never really was an answer on how to accomplish the
task 
> except "you're getting the right behavior with a 400 response":
> http://marc.info/?l=tomcat-user&m=115602705505727&w=2
>
> Finally, through some other research, it seems as though someone was 
> trying to use mod_vhost_alias to accomplish the same thing.
>
> Any thoughts or suggestions are welcome.
>
> Thank you for your time.
>
> _________________________________________________________________
> Make every IM count. Download Messenger and join the i'm Initiative
now. 
> It's free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07
>
>
> ---------------------------------------------------------------------
> 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
>
> 


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


---------------------------------------------------------------------
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: Dynamic URIs Using one Context

Posted by Johnny Kewl <jo...@kewlstuff.co.za>.
Interesting question....  this is wot I would do.... try!
The basic thing I would use Apache Httpd for it to.... direct via Virtual 
hosting and the worker file... domain names to various tomcat instances.
eg you can have 2 tomcat instances on a machine and tomcat spread across 
many machines.

So domain names become things like Games.ServiceProvider.Net 
Accounts.ServiceProvider.Net   Webs.ServiceProvider.Net 
Free.ServiceProvider.Net

..... Context paths as far as I am concerned dont work... nor do I (you) 
really want them....
It works on the web-app name and the uri mapping in web.xml.... or the 
web-app name and the path to the jsp..... forget about context paths.
It makes more sense outside of context paths, anyway...

So if a client writes an app    the uri will be
AssignedMachine/WebAppName/servletname
AssignedMachine/WebAppName/pathto.Jsp

etc...

In theory you can mess with the relative URI.... but in practice you cant...
For example if you just change the webappname of the WAR... you will see 
that uri also changes... and tomcat does the right thing with the context 
paths (automatically!).
If you change the path to a jsp.... it will change the uri.
If you change the servlet mapping in web.xml you can put the servlet 
anywhere..... eg 
AssignedMachine/WebAppName/Some/more/stuff/in/servlet/mapping
etc etc....

BUT..... if you mess with this and even if you wanted to and could override 
the context paths..... it will probably break the web-app 8 out of 10 times 
because programmers often hardcode paths inside their apps.... or have used 
relative contexts that they expect to be there.

Point is.... if you forget about the users name in the uri.... life gets 
easy... you will be dropping web-apps into a tomcat web-app... and going for 
a coffee break.
Sometimes 2 users will have the same web app name.... you dont change 
it..... thats why you got multiple tomcat instances. Funstuff1.SP.net etc.
Sometimes the user will want the root of the domain.... and his own domain 
name.... that requires a restart of the system.... because you going to use 
apache to map that 2  the TomcatsInstancesWithOwnDomainNames.... and each 
tomcat will Map via the hosts section to that users own webapp location....
ie if a user wants a domain name... they get their very own tomcat (web-app 
location)... and they can use ROOT.... ie they own that domain.
Own domain name users will need a restart... so you try isolate that 
system... own domain users pay more..... but they got their own tomcat.

Keeping track of users..... spreadsheets.... ie webappx belongs to userx
Domainer's.... a good question now will be.... can the tomcat manager be 
used to install web-app remotely.... only in one <host docbase> section and 
not the others..... if so its great.... once setup... own domainers... do 
their own thing.

Other thing is if a user... an own domainer... ever wanted load 
balancing.... its easy to provide....

If you want to get it to what you suggesting.... just tell the users that 
their webapp name must be their username.... thing is, I think you will find 
thats the last thing most people want in thier uri..... 
Accounts.SP.net/JohnnyKewl/InvoiceSystem/     ..... yuk!

Something like that..... nice interesting project..... have fun....


----- Original Message ----- 
From: "Nathan Hook" <ho...@hotmail.com>
To: <us...@tomcat.apache.org>
Sent: Tuesday, May 15, 2007 8:28 PM
Subject: Dynamic URIs Using one Context


> We've been given a difficult problem to solve and I'm hoping that some 
> help/insight is available on this mailing list.
>
> We are an Application Service Provider (ASP) that has numerous clients 
> with the number of clients increasing rapidly.  All our clients use the 
> same application but each client needs/wants a distinguishing element in 
> the url to identify them to their users.
>
> Here is our current setup:
>
> Apache 2.2 with mod_jk sending requests to Tomcat 5.5.  Struts 1.3.8 is 
> our current web framework.
>
> In our httpd.conf we have a different domain name for each client:
>
> <VirtualHost *:80>
>    ServerName <client name 1>.<server name>.com
>    DocumentRoot <some directory>/<client name 1>.<server name>.com
> </VirtualHost>
>
> <VirtualHost *:80>
>    ServerName <client name 2>.<server name>.com
>    DocumentRoot <some directory>/<client name 2>.<server name>.com
> </VirtualHost>
>
> Then in our server.xml config file for Tomcat we only declare one Host 
> element with a Context that has many Alias':
>
> <Host name="<client name 1>.<server name>.com" appBase="webapps">
>    <Context path="/app" >
>    </Context>
>    <Alias><client name 2>.<server name>.com</Alias>
>    <Alias><client name 3>.<server name>.com</Alias>
>    ...etc for each of our clients...
> </Host>
>
> So, what is the problem?  Well, when we add a new customer we have to edit 
> the httpd.conf, the server.xml, restart both applications, and add the new 
> <customer>.<server name>.com to DNS (Usually, we have to wait until late 
> into the evening to do these tasks).  Our Client Services team want the 
> ability to add customers without having to wait until we can restart our 
> servers.
>
> Is it possible to do the following with an Apache 2.2 and Tomcat 5.5 
> combination while having only ONE instance of the application only once 
> loaded in Tomcat?  (Meaning we do NOT want the application loaded by 
> Tomcat x times, with x being the number of clients we have.)
>
> <base name>.<server name>.com/<client name 1>/app
> <base name>.<server name>.com/<client name 2>/app
> <base name>.<server name>.com/<client name 3>/app
>
> I'm not really the best with how the Context attribute works outside of 
> having it placed in the server.xml.  I've tried reading the documentation 
> on Contexts at:
> http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html
> But, I find what is explained a tad bit confusing.
>
> Here is one thread from the archives that explained our problem pretty 
> well, but there never really was an answer on how to accomplish the task 
> except "you're getting the right behavior with a 400 response":
> http://marc.info/?l=tomcat-user&m=115602705505727&w=2
>
> Finally, through some other research, it seems as though someone was 
> trying to use mod_vhost_alias to accomplish the same thing.
>
> Any thoughts or suggestions are welcome.
>
> Thank you for your time.
>
> _________________________________________________________________
> Make every IM count. Download Messenger and join the i'm Initiative now. 
> It's free. http://im.live.com/messenger/im/home/?source=TAGHM_MAY07
>
>
> ---------------------------------------------------------------------
> 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
>
> 


---------------------------------------------------------------------
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: Dynamic URIs Using one Context

Posted by Hassan Schroeder <ha...@gmail.com>.
On 5/15/07, Nathan Hook <ho...@hotmail.com> wrote:

> We are an Application Service Provider (ASP) that has numerous clients with
> the number of clients increasing rapidly.  All our clients use the same
> application but each client needs/wants a distinguishing element in the url
> to identify them to their users.

> Then in our server.xml config file for Tomcat we only declare one Host
> element with a Context that has many Alias':

> So, what is the problem?  Well, when we add a new customer we have to edit
> the httpd.conf, the server.xml, restart both applications, and add the new
> <customer>.<server name>.com to DNS

OK, maybe I'm missing something, but if you want *one* context to
handle *all* requests -- why not just make that the default? Don't even
bother to specify any hostnames or aliases. Voila. :-)

You still have to have the DNS entries, but you knew that...

And it's not clear whether you're serving unique static content from the
httpd DocumentRoot you specify; if not, you could just get rid of that --
using httpd -- as well.

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.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