Using Tomcat+Apache, my web.xml's <welcome-file-list> is being ignored, and only Apache's DirectoryIndex is being used. Why?

JIA Java Italian Association

[More question:

I've got Apache 1.3.12 running with tomcat 3.2.1. In httpd.conf there is a DirectoryIndex like this:

DirectoryIndex index.cgi index.shtml index.html index.htm

In my web.xml file I have a welcome-file-list definition like this:


The problem is that tomcat is seeming to be passed the httpd.conf's DirectoryIndex and ignoring its own welcome-file-list. For example the webapps root will have both an index.jsp and an index.shtml in it. But only the index.shtml is served. If I rename index.shtml (or delete it), then Apache (not tomcat) gives me a standard "403 Forbidden" error page. ]

The reason is that Tomcat is not in charge of that process, since it is not the web server.

When you hit http://www.foo.com/ the web server on port 80 is taking care of redirecting you to the "index" page (a/k/a welcome file, a/k/a directory index) you've defined. In your case Apache will look for the list you've provided.

Try to shut down apache and use just tomcat, and you will see the <welcome-file-list> working.

[ The solution, then, is to add "index.jsp" to the front of the Apache DirectoryIndex line, like

DirectoryIndex index.jsp index.cgi index.shtml index.html index.htm

The new Tomcat connector, mod_webapp, is able to read web.xml directly, so it should (?) remove the need to have a separate DirectoryIndex line. -Alex]