You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Knight <an...@leftfieldpublishing.com> on 2010/07/31 05:36:40 UTC

Is it possible to set up an alias to a directory?

Hi,

I've got a general configuration question for Tomcat 6. I've read the 
documentation and done a bit of searching but could not find a solution. I'm 
looking to set up the following:

International site: widgets.com

Local sites like: widgets.com/au, widgets.com/uk etc

An alias for widgets.com.au to widgets.com/au and an alias for widgets.co.uk to 
widgets.com/uk etc for 27 countries

The idea is to have a seamless transition from domestic sites to directories 
on a central site, but have the local market sites appear to function as 
independent sites. We already have 27 local sites that have been in existence 
for a long while and are well known to our customers.

I thought that it could be solved by setting up the local sites like 
widgets.com.au as virtual hosts resolving to the appropriate directory but the 
documentation states "Note that the directory structures under the appBase for 
each host should not overlap each other.". What are the issues when the 
directory structures of virtual hosts overlap?

Thanks,

Andrew


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


Re: Is it possible to set up an alias to a directory?

Posted by Mark Thomas <ma...@apache.org>.
On 04/08/2010 15:32, André Warnier wrote:
> Hassan Schroeder wrote:
>> On Wed, Aug 4, 2010 at 1:39 AM, Andrew Knight
>> <an...@leftfieldpublishing.com> wrote:
>>
>>> I can see a couple of them working well. I've been testing the
>>> domestic sites as
>>> symlinks to a /cms directory, and
>>
>>> displays the relevant content (virtual host or symlink directory).
>>> This way is
>>> just runs as just 1 WAR file and I do not need to worry.
>>
>> Just keep in mind that undeploying a WAR *may* also remove the
>> contents of any directories symlinked from the expanded WAR  :-)
>> (yes, that's the voice of experience...)
>>
> 
> Was that not fixed/changed/made optional in some recent version of Tomcat ?

Nope. And no plans to change.

Maybe you were thinking of the alias feature in Tomcat 7?

Mark



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


Re: Is it possible to set up an alias to a directory?

Posted by Hassan Schroeder <ha...@gmail.com>.
On Wed, Aug 4, 2010 at 7:32 AM, André Warnier <aw...@ice-sa.com> wrote:

>> Just keep in mind that undeploying a WAR *may* also remove the
>> contents of any directories symlinked from the expanded WAR  :-)
>> (yes, that's the voice of experience...)
>
> Was that not fixed/changed/made optional in some recent version of Tomcat ?

Dunno, but I would make sure any symlinked directories have current
backups before testing  :-)

Just sayin'...
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

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


Re: Is it possible to set up an alias to a directory?

Posted by André Warnier <aw...@ice-sa.com>.
Hassan Schroeder wrote:
> On Wed, Aug 4, 2010 at 1:39 AM, Andrew Knight
> <an...@leftfieldpublishing.com> wrote:
> 
>> I can see a couple of them working well. I've been testing the domestic sites as
>> symlinks to a /cms directory, and
> 
>> displays the relevant content (virtual host or symlink directory). This way is
>> just runs as just 1 WAR file and I do not need to worry.
> 
> Just keep in mind that undeploying a WAR *may* also remove the
> contents of any directories symlinked from the expanded WAR  :-)
> (yes, that's the voice of experience...)
> 

Was that not fixed/changed/made optional in some recent version of Tomcat ?


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


Re: Is it possible to set up an alias to a directory?

Posted by Hassan Schroeder <ha...@gmail.com>.
On Wed, Aug 4, 2010 at 1:39 AM, Andrew Knight
<an...@leftfieldpublishing.com> wrote:

> I can see a couple of them working well. I've been testing the domestic sites as
> symlinks to a /cms directory, and

> displays the relevant content (virtual host or symlink directory). This way is
> just runs as just 1 WAR file and I do not need to worry.

Just keep in mind that undeploying a WAR *may* also remove the
contents of any directories symlinked from the expanded WAR  :-)
(yes, that's the voice of experience...)

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

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


Re: Is it possible to set up an alias to a directory?

Posted by Andrew Knight <an...@leftfieldpublishing.com>.

>On 31/07/2010 04:36, Andrew Knight wrote:
>> Hi,
>> 
>> I've got a general configuration question for Tomcat 6. I've read the
>> documentation and done a bit of searching but could not find a solution. I'm
>> looking to set up the following:
>> 
>> International site: widgets.com
>> 
>> Local sites like: widgets.com/au, widgets.com/uk etc
>> 
>> An alias for widgets.com.au to widgets.com/au and an alias for widgets.co.uk 
>to
>> widgets.com/uk etc for 27 countries
>> 
>> The idea is to have a seamless transition from domestic sites to directories
>> on a central site, but have the local market sites appear to function as
>> independent sites. We already have 27 local sites that have been in existence
>> for a long while and are well known to our customers.
>> 
>> I thought that it could be solved by setting up the local sites like
>> widgets.com.au as virtual hosts resolving to the appropriate directory but 
the
>> documentation states "Note that the directory structures under the appBase 
for
>> each host should not overlap each other.". What are the issues when the
>> directory structures of virtual hosts overlap?
>
>Multiple deployments - particularly problematic if WARs are being used. It is 
>complicated by the fact that there is a fundamental different between docBase 
>>and appBase. It is not a simple directory structure.
>
>If this was just static content, a lot of the issues can be side-stepped but as 

>soon as you use WARS and/or dynamic content things get trickier.
>
>I assume that you don't want to put in place a simple redirect from 
>widgets.com.au to widgets.com/au
>
>One option that keeps the appearance of separate sites would be:
>- set up Tomcat to server widgets.com, widgets.com/uk, etc
>- use a reverse proxy (eg httpd)
>- configure the reverse proxy to proxy widgets.com.uk and widgets.com/uk to /uk 

>on the Tomcat server
>
>Another option might be to set up a single host on Tomcat for widgets.com with 
>aliases for all the other hosts and then add a filter that checks the host 
>>header and forwards the request to the right context.
>
>Note, YMMV - I haven't tested any of the above.
>
>Mark

Hi Mark,

Thanks for the ideas, they make a lot of sense :-)

I can see a couple of them working well. I've been testing the domestic sites as 

symlinks to a /cms directory, and the content in /cms adapts for the appropriate 

local language etc based on the request. All the stuff in cms runs from 1 layout 

page that just calls appropriate jsp module pages for the content. 

I've just updated /index.jsp so that it detects if the request is for a cms page 
and 

displays the relevant content (virtual host or symlink directory). This way is 
just runs 

as just 1 WAR file and I do not need to worry.

Thanks again.

Andrew

Re: Is it possible to set up an alias to a directory?

Posted by Mark Thomas <ma...@apache.org>.
On 31/07/2010 04:36, Andrew Knight wrote:
> Hi,
>
> I've got a general configuration question for Tomcat 6. I've read the
> documentation and done a bit of searching but could not find a solution. I'm
> looking to set up the following:
>
> International site: widgets.com
>
> Local sites like: widgets.com/au, widgets.com/uk etc
>
> An alias for widgets.com.au to widgets.com/au and an alias for widgets.co.uk to
> widgets.com/uk etc for 27 countries
>
> The idea is to have a seamless transition from domestic sites to directories
> on a central site, but have the local market sites appear to function as
> independent sites. We already have 27 local sites that have been in existence
> for a long while and are well known to our customers.
>
> I thought that it could be solved by setting up the local sites like
> widgets.com.au as virtual hosts resolving to the appropriate directory but the
> documentation states "Note that the directory structures under the appBase for
> each host should not overlap each other.". What are the issues when the
> directory structures of virtual hosts overlap?

Multiple deployments - particularly problematic if WARs are being used. 
It is complicated by the fact that there is a fundamental different 
between docBase and appBase. It is not a simple directory structure.

If this was just static content, a lot of the issues can be side-stepped 
but as soon as you use WARS and/or dynamic content things get trickier.

I assume that you don't want to put in place a simple redirect from 
widgets.com.au to widgets.com/au

One option that keeps the appearance of separate sites would be:
- set up Tomcat to server widgets.com, widgets.com/uk, etc
- use a reverse proxy (eg httpd)
- configure the reverse proxy to proxy widgets.com.uk and widgets.com/uk 
to /uk on the Tomcat server

Another option might be to set up a single host on Tomcat for 
widgets.com with aliases for all the other hosts and then add a filter 
that checks the host header and forwards the request to the right context.

Note, YMMV - I haven't tested any of the above.

Mark



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