> Hi, > > I want to find out how to correctly fix BZ 41430 and 36121. They have to > do with the way mod_dir and mod_jk interact. Before fixing the code I > find it necessary to define the correct behaviour, which seems to be > non-trivial. > > The behaviour needs to be described depending on DirectoryIndex and > "JkOptions ForwardDirectories". > > I try to answer via two general rules, that I suggest: > > A) The first entry in DirectoryIndex that exists either locally or > matches a JkMount stops the procedure. If it exists locally it gets > served by Apache, if it matches a JkMount and does not exist locally it > gets forwarded to Tomcat. > > B) If no entry in DirectoryIndex exists locally or matches a JkMount, > the Option ForwardDirectories decides: Off=Apache, On=Tomcat. The > forwarded request is the original request without any DirectoryIndex files. > > I haven't checked, if this can be implemented easily. I first want to > know, if this seems like a reasonable behaviour? > > The downside is: If you have "JkMount /*.jsp w" and "DirectoryIndex > index.jsp", Apache will send all dirs with index.jsp to Tomcat.
I'm not comfortable with this. The fact is that the Apache + mod_jk + Tomcat, Inc. is meant to allow the delivery of static content through Apache, while still allowing Tomcat to do the dirty work. So, if I have a directory with an index.html in it, I probably want it to be statically delivered by Apache, not by Tomcat. Thereby, I would rewrite your rules this way: A.1) the first existant file specified in a DirectoryIndex which doesn't also match a JkMount is served by Apache, if any; A.2) otherwise, the first DirectoryIndex matching a JkMount is served by Tomcat, regardless whether it is visible or not by Apache, if any; B.1) otherwise, if the Option ForwardDirectories is on, the directory request is forwarded to Tomcat; B.2) otherwise, the directory request is served as is by Apache (to get a directory list or a 4xx error). This way Apache would first attempt the fast rail (delivery of static content) and would forward to Tomcat only when can't stand by its own (dynamic content). This means, however, that dirs which have to be forwarded as such to Tomcat would need a specific <Directory> entry with no DirectoryIndex in it. Also (and I know this is quite O.T.), why JkMount can't be directory-based? This would help in some cases, expecially with complex portals which may adopt different scripting techs in different areas (jsp, jsf, jspx etc), but even with directory-based servlets (the ones that map like "JkMount /xyservlet/*". Finally, it seems to me that mod_jk doesn't map a request to tomcat as a sub-request, but instead seems to tweek the req->main field, which may probably create the kind of problems reported in BZ 36121. I'm not an expert of the apache req structure nor of the mod_jk designs, but I have the "feeling" that it should go in a sub-request instead. Am I wrong? This would also allow for a probably slower, but more complete integration between Apache and Tomcat. In example, it would be (probably?) possible to detect a 404 response from Tomcat to a given DirectoryIndex name and attempt the next in list, if any. Which in turn could allow a DirectoryIndex behaviour much more uniform between the mod_jk and non-mod_jk cases. Between 0 and 10, how much am I wrong? Giampaolo > Here are some cases: > > Assume we have DirectoryIndex file1 file2 and we process a request > /test/ which points to /path/test/. > > 1) Non of the files /path/test/file1 and /path/test/file2 exist, non of > them matches any JkMount. > > a) ForwardDirectories is not set: Apache tries to serve the directory > /path/test/ > > b) ForwardDirectories is set: We forward the original request to Tomcat > (/test/) without file1 or file2. > > 2) Non of the files /path/test/file1 and /path/test/file2 exist, but one > of them (assume file1) matches a JkMount. > > We forward /test/file1. > > 3) At least one of the files exists (assume file2), non of them matches > any JkMount. > > a) ForwardDirectories is not set: Apache tries to serve /path/test/file2 > > b) ForwardDirectories is set: Again Apache tries to serve /path/test/file2. > > 4) At least one of the files exists (assume file2), and file1 matches a > JkMount. > > Apache serves /path/test/file2, or forward /test/file1, whichever comes > first in the DirectoryIndex list. > > 5) The same file file1 that exists, also matches a JkMount. > > Apache serves locally /path/test/file1. > > Thanks > > Rainer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]