Caldarale, Charles R wrote:
From: Mark Shifman [mailto:mark.shif...@yale.edu]
Subject: Re: canonical hostnames for tomcat server

host name aliases may help
http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#Host%20Name%20Aliases

I don't think aliases will do it.  Look at virtual hosting in Tomcat:
http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html

Set up an additional <Host> with a name attribute of "portal.example.com" with an appBase that 
points to the webapps you want to use with that domain.  Any requests that do not match that specific domain 
will be handled by the <Engine>'s defaultHost, which you can leave as "localhost".

I think the OP not only wants to have the requests handled by the host whose name corresponds to the one in the request. He also wants, if this request hostname is /not/ the canonical one myhost.company.com, to /not/ serve the request, but (externally) re-direct the browser to the canonical host.
In other words, he wants to "educate" his users.

I suppose you could still do it with 2 <Host> sections, the non-default being the canonical one which answers normally, and the default <Host> having /something/ inside which returns a 301 (?) redirect for every request, to the canonical one.
How would one do this under Tomcat however ?
Create a default servlet which processes all requests and always issues a re-direct response ? or is there a simpler solution ?

That's why I was saying that the simplest solutions may well be the ones he mentioned at the beginning.


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

Reply via email to