You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Stephen Carville <st...@totalflood.com> on 2005/08/03 21:18:00 UTC

[users@httpd] JSP pages and Apache 2

During a migration from Apache 1 to Apache 2 I found a problem with 
DirectoryIndex in VirtualHosts

I have several Virtual Hosts defined with a DirectoryIndex:

<VirtualHost *:80>
     ServerName      www.nationwide-totalflood.com
     DocumentRoot    /var/jakarta/dpsi-corp/ROOT
     DirectoryIndex  HomePage.jsp index.html
     JkMount         /*.jsp  worker1
     JkMount         /servlet/* worker1
</VirtualHost>

Problem is if I use the above DirectoyIndex, Apache always displays
index.html.  If I remove index.html then HomePage.jsp is passed to
tomcat normally.  I can work around this but it is frustrating that
Apache 2 should behave so differently from Apache 1.

-- 
Stephen Carville <st...@totalflood.com>
Unix and Network Admin
Nationwide Totalflood
6033 W. Century Blvd
Los Angeles, CA 90045
310-342-3602

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] JSP pages and Apache 2

Posted by Stephen Carville <st...@totalflood.com>.
John Hicks wrote:
> Stephen Carville wrote:
> 
>> During a migration from Apache 1 to Apache 2 I found a problem with 
>> DirectoryIndex in VirtualHosts
>>
>> I have several Virtual Hosts defined with a DirectoryIndex:
>>
>> <VirtualHost *:80>
>>     ServerName      www.nationwide-totalflood.com
>>     DocumentRoot    /var/jakarta/dpsi-corp/ROOT
>>     DirectoryIndex  HomePage.jsp index.html
>>     JkMount         /*.jsp  worker1
>>     JkMount         /servlet/* worker1
>> </VirtualHost>
>>
>> Problem is if I use the above DirectoyIndex, Apache always displays
>> index.html.  If I remove index.html then HomePage.jsp is passed to
>> tomcat normally.  I can work around this but it is frustrating that
>> Apache 2 should behave so differently from Apache 1.
>>
> 
> The DirectoryIndex directive merely tells Apache what file to serve  if 
> no file is requested (i.e. if a directory only is specified). In other 
> words, this file is served in place of a directory listing (or index).

Both files are present but for some reason, Apache 2 will not display 
HomePage.jsp if index.html is present.  Apache 1 respected the order. 
The problem could be in mod_jk or tomcat since it only happens with jsp 
pages.  However, one of the developers asked on the tomcat list and was 
told it was an Apache issue.

> If you don't want to display index.html, the simplest solution would be 
> to delete that file from the directory. (If you do want to display it, 
> but not as a directory index, why not rename it to something other than 
> "index"?)

I'd like to but index.html is one of the error 404 pages and the 
developers claim they don't have time to go back thru the old code and 
fix all the references to it.  I can sympathize because when I tried to 
get rid of HomePage.jsp (it just serves a static page depending on the 
domain requested) and replace it with a more sensible VirtualHosts and 
only calling tomcat when a jsp is actually needed, hundreds of pages 
broke.  The original developer would only write in Java.

Franky the whole thing need to be torn down and rewritten but that is 
not going to happen so I have to find work arounds.  Is hoping this one 
had an easy fix.

-- 
Stephen Carville <st...@totalflood.com>
Unix and Network Admin
Nationwide Totalflood
6033 W. Century Blvd
Los Angeles, CA 90045
310-342-3602

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] JSP pages and Apache 2

Posted by John Hicks <jo...@gulfbridge.net>.
Stephen Carville wrote:
> During a migration from Apache 1 to Apache 2 I found a problem with 
> DirectoryIndex in VirtualHosts
> 
> I have several Virtual Hosts defined with a DirectoryIndex:
> 
> <VirtualHost *:80>
>     ServerName      www.nationwide-totalflood.com
>     DocumentRoot    /var/jakarta/dpsi-corp/ROOT
>     DirectoryIndex  HomePage.jsp index.html
>     JkMount         /*.jsp  worker1
>     JkMount         /servlet/* worker1
> </VirtualHost>
> 
> Problem is if I use the above DirectoyIndex, Apache always displays
> index.html.  If I remove index.html then HomePage.jsp is passed to
> tomcat normally.  I can work around this but it is frustrating that
> Apache 2 should behave so differently from Apache 1.
> 

The DirectoryIndex directive merely tells Apache what file to serve  if 
no file is requested (i.e. if a directory only is specified). In other 
words, this file is served in place of a directory listing (or index).

If you don't want to display index.html, the simplest solution would be 
to delete that file from the directory. (If you do want to display it, 
but not as a directory index, why not rename it to something other than 
"index"?)

Hope that helps.

John Hicks


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org