tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Giampaolo Tomassoni" <Giampa...@Tomassoni.biz>
Subject RE: Discussion mod_jk and mod_dir interaction
Date Tue, 30 Jan 2007 16:24:11 GMT
From: Rainer Jung [mailto:rainer.jung@kippdata.de]
> 
> I think we agree, that DirectoryIndex should not replace the 
> welcome-file list on the Tomcat side.
> 
> This means at least: if non of the entries in the DirectoryIndex list is 
> visible by Apache, it should not try to prepend any of them to the URL 
> and send to Tomcat, even if this would match a JkMount. OK? For any of 
> the entries in the welcome-list it would suffice to send a directory 
> request forward.

This is basicly how is mod_jk-1.1.20 actually working, right?


> Now a few cases are left over:
> 
> 1) If Apache can see a file from DirectoryIndex, should it serve it 
> locally, or send it to Tomcat? The easy answer would be: serve it 
> locally in any case. As a consequence, when mixing dynamic and static 
> content one would need to use a different file name to distinguish the 
> two (or use a more elaborate per directory or location Apache config). 
> This doesn't sound too unreasonable.

But this is going to change the actual semantic of JkMount, I think.

JkMount is the only thing we have to distinguish a resource served by Tomcat to one which
may be served by Apache. If something matches a JkMount, we can't simply ignore it because
it is visible also by Apache. Think to .jsp files in an exploded war, in example.


> The other option would be: send it to Tomcat, if it matches a JkMount. 
> In that case Apache manipulates a browser request and sends the 
> manipulated request to Tomcat. I tend to disagree with this option
> 2) If Apache can not see any file from DirectoryIndex. How should the 
> forwarding behaviour depend on JkMount and ForwardDirectories? If the 
> request matches a JkMount, it should definitely be forwarded. If it 
> doesn't match a JkMount, it doesn't sound very convincing to forward at 
> all. So I don't see a good use case for an option "ForwardDirectories".

Ok, I see that the main idea in your post is to implement small adjustments. I'll try to cope
with this.

I think there is a reason for why mod_jk provides a directive named "JkMount". The purpouse
is to basicly map a name in a virtual filesystem. So, what a directive like DirectoryIndex
may or may not see may be irrilevant. I mean, it does matter to performances, but it should
minimize any impact in behaviour. So, when we say that "DirectoryIndex should use all the
filenames it sees", this should probably include the JkMount-ed ones.

The main problem here is that Apache doesn't actually know which resource will be available
and which will not on the Tomcat side. Thereby, we should implement some tricks to allow smooth
handling of most cases.

Apart giving priority to the DirectoryIndex-specified files which are "phisically visible"
in order to improve performances (a questionable point, I agree, since one can probably manually
reorder them in a better way), I guess that we should distinguish between JkMount-ed extensions
and directories: the first are probably to be involved in the DirectoryIndex handling, since
they often map to extension-based servlets, while when a request maps to a JkMount directory,
the DirectoryIndex handling should not be applied: these kind of JkMounts are often mapped
to path-based servlets on the Tomcat side, instead. Often, path-based servlets need to handle
the whole directory request by their own.

This would basicly support your thoughts about the JkOption ForwardDirectories. We may, however,
maintain upward compatibility by discriminating JkMount-ed directories the way I suggest only
iff a JkOption ForwardDirectories is actually specified.

In summary, this mean that in case of a directory request the flow could be:

 a) Iff the request is a directory mapped by a JkMount AND JkOption ForwardDirectories
    is specified, then forward the request to Tomcat;

 b) otherwise, if the directory request is backed by an Options +Indexes, scan the
    DirectoryIndex by assuming all the JkMount-ed extensions as existant files.
    The first "found" file, if any, is handled by Tomcat if it has a JkMount-ed extension,
    by Apache otherwise;

 c) If no file is "found", JkOption ForwardDirectories matters. If it is specified,
    forward the directory request to Tomcat;

 d) otherwise, yield back the directory request to Apache (directory list or 4xx error).


By the way, how's the implementation of this stuff in mod_jk-1.1.19? Do you have an idea about
it?

Also, may someone explain to me how does BZ 36121 deals with this? I guess that is a problem
due to r->main tweaking, not to how a directory-based request should be handled. Am I wrong?

Cheers,

Giampaolo

> 
> Regards,
> 
> Rainer> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message