I think you can do this using the special ROOT context.

In tomcat 5.5.12 I have the file:
conf/Catalina/localhost/ROOT.xml

which contains:
<Context path="ROOT" docBase="/path/to/app" reloadable="false" debug="5"
privileged="false">
etc

I think in previous versions you would put the same <context> node directly
in server.xml

Hope that helps...

w: www.anorakgirl.co.uk

-----Original Message-----
From: Tim Lucia [mailto:[EMAIL PROTECTED]
Sent: 18 January 2006 16:38
To: users@tomcat.apache.org
Subject: How do I hide a web application's actual context from the
client?


What is the recommended, or best-practice, method for deploying a web
application such that its actual context is hidden from the user, but still
maintains a session?  In other words, I wish to deploy myapp.war
(tomcathost:8080/myapp/...) but have it exposed to the client as
www.mysite.com.

http://www.mysite.com/ --AJP--> tomcathost:8009/myapp/

I am currently fronting clustered tomcats with Apache, so I have tried
mod_rewrite, which gets the request there correctly by prepending /myapp to
$1.  The problem then is that /myapp sets the session cookie JSESSIONID=...;
path=/myapp, and then the browser does not send the cookie back for requests
to /.

I have investigated the URLRewriteFilter (Paul Tuckey,
http://tuckey.org/urlrewrite) as posted in December on a thread on this list
("URL rewriting best practice?") and that would appear to suffer the same
problem (it would not get invoked for / if deployed as a filter for /myapp.)

I would like to avoid redirecting to www.mysite.com/myapp, since I intend to
change the context for versioning and I don't want the redirected URL to be
visible (or bookmarked.)

I have spent several hours with Google and reading the mail archive, and
haven't found quite what I am looking for (except that using Apache's
mod_rewrite intentionally (for security reasons) does not rewrite cookie
paths, which would solve this problem.)  A cookie-rewriting filter would be
a possibility, although I believe it would have to live inside Apache, and
it can't be too slow (i.e., running a script).  Maybe Apache::Cookie
(http://httpd.apache.org/apreq/Apache-Cookie.html) does what I want?  (I am
not a Perl programmer).

I appreciate any pointers or advice that anyone can offer.

Tim Lucia




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to