Bug 41430 - JkOptions +ForwardDirectories with Apache's DirectoryIndex
Summary: JkOptions +ForwardDirectories with Apache's DirectoryIndex
Status: RESOLVED WONTFIX
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: mod_jk (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 regression (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-22 02:26 UTC by Giampaolo Tomassoni
Modified: 2009-12-21 00:07 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giampaolo Tomassoni 2007-01-22 02:26:19 UTC
In apache-2.0.58 + apr-0.9.12 + mod_jk-1.1.20 + JBoss-4.0.5.GA (Tomcat 5.5), 
when a Tomcat webapp is published through an apache vhost and:

- both JkOptions +ForwardDirectories and DirectoryIndex are specified;
- Apache can't stat() the specified index file, since it is expected to be 
handled virtually by Tomcat (i.e.: it is "index.jsf" like in Java ServletFaces 
applications);

then issuing a request on a directory entry to Apache (like, in example, 
http://www.domain.tld/) would not redirect the client to request the 
DirectoryIndex-specified resource (i.e. http://www.domain.tld/index.jsf) but 
would instead forward it up to Tomcat as-is.

This results in displaing the directory content (or a 404 error), instead of 
the wanted index virtual file.

Please note that up to mod_jk-1.1.19 the behaviour I was seing was the 
expected one: the client was redirected to request the virtual index resource 
regardless of the existance of such a file in the directory published by 
Apache.
Comment 1 Mark Thomas 2007-01-22 04:14:53 UTC
This might be related to the fix for bug 36121.
Comment 2 Giampaolo Tomassoni 2007-01-22 04:30:59 UTC
How can I get that single patch? I would attempt rolling it back in my mod_jk-
1.1.20 and test if this is the cause, but it is not attached to 
http://issues.apache.org/bugzilla/show_bug.cgi?id=36121.
Comment 4 Rainer Jung 2007-01-22 13:49:14 UTC
Did you add index.jsf to the list of welcome pages in youe web.xml on the tomcat
side?
Comment 5 Giampaolo Tomassoni 2007-01-22 14:01:14 UTC
Yes, but it doesn't work: I can't get the auto-index working. It doesn't work 
even by connecting to the Tomcat's default http service port (8080), thereby 
by-passing the JK Connector.

Please note I'm using jsf + facelets + seam + jboss, so, probably one of these 
components doesn't behave as expected with <welcome-file-list>. The fact is 
that I found a great solution to this in mod_jk and I'm actually depending on 
this. I could eventually backup implementing a <filter>, but this would at 
least mean that something is wrong in the JK docs regarding 
+ForwardDirectories + DirectoryIndex.

About your patch. I just got back home and I'm going to roll it back from my 
copy of mod_jk-1.1.20. I'll tell you soon.
Comment 6 Giampaolo Tomassoni 2007-01-22 14:27:39 UTC
Your "might be" is definitely right, Mark: that single-line change does 
matter...

Reversing the patch to 1.1.20 restores mod_jk's previous behaviour.

I don't completely get the matter of bug 36121. Do you think the two 
behaviours may be made somehow compatible in 1.1.21, or instead enforcing one 
would mean voiding the other?

I would like to be prepared to the next mod_jk release...
Comment 8 Mark Thomas 2007-01-22 16:41:04 UTC
Both behaviours are valid use cases. It should be possible to get mod_jk to
handle both correctly but it might take someone with more mod_jk expertise than
I to do it.
Comment 9 Rainer Jung 2007-01-23 11:34:44 UTC
I will investigate until next week. If the use cases are compatible, I'm
optimistic that we'll find a solution.
Comment 10 Rainer Jung 2007-01-29 03:51:48 UTC
To find a good solution, please participate in the discussion:

http://marc.theaimsgroup.com/?l=tomcat-dev&m=117007124924707&w=2
Comment 11 Michael Bu 2007-03-27 22:05:37 UTC
Any update on this one? Having same problem here with mod_jk-1.1.21
Comment 12 Mladen Turk 2007-03-27 23:28:12 UTC
No progress, and I must say for a zillion of times:

Do not map your web application physically to the Apache document tree.
It is a *BIG* security hole and it breaks all the Servlet specifications.

Default application (directory) welcome file *MUST* be decided by
configuring the application itself trough the web.xml

I'm not interested of fixing this, and I would suggest that if it doesn't
work for you, configure it like it is supposed to be configured.

If some commiter is willing to fix that, fine with me, but like said,
it's a complete waste of time and specifications.

Regards.
Comment 13 Tom Harris 2007-04-10 19:29:52 UTC
This seems very similar to an issue I am having with JK 1.2.21.
a request for 
http://www.domain.tld/
returns the tomcat ROOT webapp index.jsp but I haven't a JkMount for the root
context.

in my httpd.conf, I have a 
DirectoryIndex /myapp/homepage.html
and
JkMount /myapp/* server1

The problem goes away when I revert back to 1.2.18 mod_jk.so.  Issue not in
1.2.19, introduced in 1.2.20

note: the local links in the ROOT webapp index.jsp do not work (as expected)
because that context is not mapped using modjk - yet that index.jsp is still served.
Comment 14 Cott Lang 2007-06-05 10:52:34 UTC
I used DirectoryIndex to allow Apache to send directory requests to my Struts
/index.do.  This worked well.  You don't appear to be able to use anything but a
file in welcome-file-list, so I'm not seeing a simple way of fixing this to work
in mod_jk 1.2.20+ - I'd prefer to avoid rewrite rules, files that redirect to my
welcome action, etc. 

Please let me know if I'm missing something obvious.
Comment 15 Mark Thomas 2007-09-06 20:38:13 UTC
Note any fix for this should not break the fix for 36121.
Comment 16 Cott Lang 2007-11-12 08:11:28 UTC
A palatable hack for me was to touch index.do in my app. It's not pretty, but it
beats creating a JSP for my welcome-file-list to just redirect to a struts app.
Comment 17 Mladen Turk 2009-12-21 00:07:48 UTC
mod_jk doesn't support DirectoryIndex any more.
Make sure the welcome-file list inside Tomcat is setup correctly.