You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by James Cribb <ja...@zip.com.au> on 2000/10/10 12:20:42 UTC

Need help with virtual hosts and servlet mapping

I'm trying to use Tomcat 3.1 with Apache and mod_jserv, but having lots
of trouble doing servlet mappings, especially with Apache virtual hosts.

I'm trying to have virtual hosts in Apache with different /images
directories in their document roots, so that

	http://www.company1.com/images/logo.gif
	http://www.company2.com/images/logo.gif
	etc.

are different images delivered by the same web server.  This much I can
do easily just with Apache.

But I also want each virtual host's home page to be produced by a
(single) servlet, i.e., requests for

	http://www.company1.com/
	http://www.company2.com/
	etc.

are all serviced by a servlet in some Tomcat context.

The problem is that I can't find a way to map "/" to Tomcat and
"/images/*" to Apache.  I tried using

	<Location /images/*>
	 SetHandler default-handler
	</Location>
and
	<Location />
	 SetHandler jserv-servlet
	</Location>

in each virtual host, but that sent requests for images to Tomcat too.

Any help will be appreciated!

Re: Need help with virtual hosts and servlet mapping

Posted by kenneth topp <ca...@prodigy.net>.
James,

If you put:

DirectoryIndex index.jsp index.html

in your apache configuration file (httpd.conf),
and have a index.jsp in the documentroot.

The request for http://www.company1.com/ will get forwarded like all
.jsp's.  This is the standard way to achive your goal.

Good Luck,

Kenneth Topp


On Tue, 10 Oct 2000, James Cribb wrote:

> I'm trying to use Tomcat 3.1 with Apache and mod_jserv, but having lots
> of trouble doing servlet mappings, especially with Apache virtual hosts.
> 
> I'm trying to have virtual hosts in Apache with different /images
> directories in their document roots, so that
> 
> 	http://www.company1.com/images/logo.gif
> 	http://www.company2.com/images/logo.gif
> 	etc.
> 
> are different images delivered by the same web server.  This much I can
> do easily just with Apache.
> 
> But I also want each virtual host's home page to be produced by a
> (single) servlet, i.e., requests for
> 
> 	http://www.company1.com/
> 	http://www.company2.com/
> 	etc.
> 
> are all serviced by a servlet in some Tomcat context.
> 
> The problem is that I can't find a way to map "/" to Tomcat and
> "/images/*" to Apache.  I tried using
> 
> 	<Location /images/*>
> 	 SetHandler default-handler
> 	</Location>
> and
> 	<Location />
> 	 SetHandler jserv-servlet
> 	</Location>
> 
> in each virtual host, but that sent requests for images to Tomcat too.
> 
> Any help will be appreciated!
>