You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dennis Lundberg <de...@mdh.se> on 2005/01/05 15:32:36 UTC
[mod_jk] Unable to get directory listings from Apache httpd 2 for
versions 1.2.5 and above
Hi all
*Our setup:*
- Solaris 8
- Apache httpd 2.0.50
- Jakarta Tomcat Connectors mod_jk 1.2.4/1.2.5/1.2.6/1.2.8
- Tomcat 4.1.31
*How we want it to work:*
1. For all configured webapps (via JkMount directives) mod_jk should
forward the requests to Tomcat
2. For all jsp-pages (via a JkMount directive) mod_jk should forward the
requests to Tomcat
3. Accesses to a (non-webapp) directory (i.e. /examples/) should go to
(in order)
- an index.jsp (via Tomcat)
- an index.shtml (via Apache httpd)
- an index.html (via Apache httpd)
- show a directory listing (mod_autoindex in Apache httpd)
*Problems:*
With mod_jk 1.2.4 this works as expected. With versions 1.2.5, 1.2.6 and
1.2.8, number 3 above doesn't work. A request for /examples/ returns a
404 from Tomcat. Looking in the mod_jk log shows that it is trying to
serve the file index.jsp, but that file doesn't exist. It should have
returned a directory listing because no valid index-file (index.jsp,
index.shtml or index.html) was found.
The reason for upgrading is that we want to use the new JkUnmount
directive. We'll be using it to be able to see jsp-files via viewcvs,
like this:
JkUnMount /cgi-bin/*.jsp connector80
*Configuration snippets*
httpd.conf
Options Indexes Includes
DirectoryIndex index.jsp index.shtml index.html
...
JkMount /*.jsp connector80
JkMount /webapp1/* connector80
JkMount /webapp2/* connector80
...
We've also tried some of the new mod_jk directives forwards and
backwards including these:
JkOptions -ForwardDirectories
JkOptions +ForwardDirectories
Is there something wrong with our setup, our is there a bug in mod_jk?
The source-code change that set this off, I believe, can be found here:
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c?r1=1.77&r2=1.78&diff_format=h
--
Dennis Lundberg, Utvecklingsledare, IT-avdelningen
e-post: dennis.lundberg@mdh.se
http://www.mdh.se/personal/VisaPerson?fornamn=Dennis&efternamn=Lundberg
tel: +46-(0)21-101516, fax: +46-(0)21-101636
Mälardalens högskola, Box 883, SE-72123 Västerås, SWEDEN
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: [mod_jk] Unable to get directory listings from Apache httpd 2
for versions 1.2.5 and above
Posted by Dennis Lundberg <de...@mdh.se>.
>> On another note, I've stumbled upon a few errors in the connectors
>> documentation after doing some serious reading to understand all this.
>> How to I go about contributing patches? Should I open an issue in
>> buzilla for the product "Tomcat5" and add patches to that?
>>
>> [1]http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c?rev=1.78&view=markup
>>
>
>
> Sure. The patches are more then welcome :).
>
> Mladen.
OK, my patches are available in bugzilla at
http://issues.apache.org/bugzilla/show_bug.cgi?id=32968
There were also some stuff that I couldn't figure out how to solve. I
put those in bugzilla as well at
http://issues.apache.org/bugzilla/show_bug.cgi?id=32969
--
Dennis Lundberg
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: [mod_jk] Unable to get directory listings from Apache httpd 2
for versions 1.2.5 and above
Posted by Mladen Turk <ml...@jboss.com>.
Dennis Lundberg wrote:
>>
>> Yes.
>> JkMount /examples3/* yourworker
>> Then:
>> JkUnMount /examples3/*.jpg yourworker
>> ...
>> JkUnMount /examples3/*.xxx yourworker
>>
>> But that's not the very wise solution.
>> You obviously wish to Apache serve your static content (e.g. images),
>> while Tomcat serving the dynamic content.
>>
>> So, organize your applications like that, moving static content to
>> a virtual space accesible only by Apache.
>> For example:
>> Make /images Alias for apache in some directory outside
>> Tomcat ROOT.
>>
>> Mladen.
>
>
> The thing is that we don't want to organize our content depending on
> whether it will be served by Apache httpd or Tomcat. That is something
> that our webeditors should not need to know about. That is also the
> reason for having a shared DocumentRoot/Root-context.
>
Fine, but what will happen if your Tomcat server is on the remote
physical box or multiple boxes if using load balancer?
You should start thinking in that direction.
Tomcat in fact is a completely different system for which you
use mod_jk for proxying requests, so the easiest is to imagine
that the Tomcat is on the remote box.
Once again .jsp is not .php so you should change the way you
think how the .jsp file is accessed.
> On another note, I've stumbled upon a few errors in the connectors
> documentation after doing some serious reading to understand all this.
> How to I go about contributing patches? Should I open an issue in
> buzilla for the product "Tomcat5" and add patches to that?
>
> [1]http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c?rev=1.78&view=markup
>
Sure. The patches are more then welcome :).
Mladen.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: [mod_jk] Unable to get directory listings from Apache httpd 2
for versions 1.2.5 and above
Posted by Dennis Lundberg <de...@mdh.se>.
Mladen Turk wrote:
> Dennis Lundberg wrote:
>
>>
>> /www/
>> /htdocs/
>> /examples1/
>> /examples2/index.html
>> /examples3/index.jsp
>> /WEB-INF/web.xml
>> /webapps/
>> /webapp1/index.jsp
>> /webapp2/index.jsp
>>
>> Now httpd is set up like this:
>> DocumentRoot "/www/htdocs"
>>
>> Tomcat has a context configured like this:
>> <Context path="" docBase="/www/htdocs" debug="0" reloadable="true"/>
>>
>>
>> The thing that didn't work before now works :-) , but one thing that
>> used to work before is now broken :-( Trying the URL:s in the
>> directory structure above gives these results:
>>
>> - Accesses to /examples1/ (Apache httpd shows a directory listing)
>> - Accesses to /examples2/ (Apache httpd serves the file index.html)
>> - Accesses to /examples3/index.jsp (Tomcat serves the file index.jsp)
>> - Accesses to /examples3/ (Apache httpd shows a directory listing)
>>
>
>> The first three work as can be expected. It's the last one that
>> puzzles me. I would like Tomcat to serve me the file index.jsp there.
>> Is that possible?
>>
>
> Yes.
> JkMount /examples3/* yourworker
> Then:
> JkUnMount /examples3/*.jpg yourworker
> ...
> JkUnMount /examples3/*.xxx yourworker
>
> But that's not the very wise solution.
> You obviously wish to Apache serve your static content (e.g. images),
> while Tomcat serving the dynamic content.
>
> So, organize your applications like that, moving static content to
> a virtual space accesible only by Apache.
> For example:
> Make /images Alias for apache in some directory outside
> Tomcat ROOT.
>
> Mladen.
The thing is that we don't want to organize our content depending on
whether it will be served by Apache httpd or Tomcat. That is something
that our webeditors should not need to know about. That is also the
reason for having a shared DocumentRoot/Root-context.
This works in mod_jk 1.2.4. Somewhere on the way to 1.2.5 something
changed that broke this functionality. Looking in CVS i found that
revision 1.78 [1] has a comment about DirectoryIndex handling.
Unfortunately it's been too long since I programmed any C so I'm at a
loss to understand what really happened there.
I think I understand why we decided to add index.jsp to our
DirectoryIndex directive now. That reason is what it would allow Apache
httpd to "check" if there is an index.jsp file available in a folder.
Given a DirectoryIndex directive like this:
DirectoryIndex index.jsp index.html
it's my understanding that Apache httpd does this when it receives a
request for say /examples4/ is this:
- Look in the DirectoryIndex directive to see what files should be checked.
- Does /examples4/index.jsp exist? If yes follow the JkMount directive
and turn over processing to Tomcat.
- Does /examples4/index.html exist? If yes serve that file.
- No more DirectoryIndex files to process. Check if directory listings
are allowed. If yes show a directory listing, if no show an error page.
It seems to me that when Apache httpd tries to see if the file index.jsp
exists, processing is turned over to Tomcat and doesn't return to httpd.
Is that correct? My feeling is that Apache httpd should be allowed to
see if the file exists before turning over processing to Tomcat.
On another note, I've stumbled upon a few errors in the connectors
documentation after doing some serious reading to understand all this.
How to I go about contributing patches? Should I open an issue in
buzilla for the product "Tomcat5" and add patches to that?
[1]http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-connectors/jk/native/apache-2.0/mod_jk.c?rev=1.78&view=markup
--
Dennis Lundberg
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: [mod_jk] Unable to get directory listings from Apache httpd 2
for versions 1.2.5 and above
Posted by Mladen Turk <ml...@jboss.com>.
Dennis Lundberg wrote:
>
> /www/
> /htdocs/
> /examples1/
> /examples2/index.html
> /examples3/index.jsp
> /WEB-INF/web.xml
> /webapps/
> /webapp1/index.jsp
> /webapp2/index.jsp
>
> Now httpd is set up like this:
> DocumentRoot "/www/htdocs"
>
> Tomcat has a context configured like this:
> <Context path="" docBase="/www/htdocs" debug="0" reloadable="true"/>
>
>
> The thing that didn't work before now works :-) , but one thing that
> used to work before is now broken :-( Trying the URL:s in the directory
> structure above gives these results:
>
> - Accesses to /examples1/ (Apache httpd shows a directory listing)
> - Accesses to /examples2/ (Apache httpd serves the file index.html)
> - Accesses to /examples3/index.jsp (Tomcat serves the file index.jsp)
> - Accesses to /examples3/ (Apache httpd shows a directory listing)
>
> The first three work as can be expected. It's the last one that puzzles
> me. I would like Tomcat to serve me the file index.jsp there. Is that
> possible?
>
Yes.
JkMount /examples3/* yourworker
Then:
JkUnMount /examples3/*.jpg yourworker
...
JkUnMount /examples3/*.xxx yourworker
But that's not the very wise solution.
You obviously wish to Apache serve your static content (e.g. images),
while Tomcat serving the dynamic content.
So, organize your applications like that, moving static content to
a virtual space accesible only by Apache.
For example:
Make /images Alias for apache in some directory outside
Tomcat ROOT.
Mladen.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: [mod_jk] Unable to get directory listings from Apache httpd 2
for versions 1.2.5 and above
Posted by Dennis Lundberg <de...@mdh.se>.
Thank you Mladen for your quick response. I think I understand things
more clearly now. One must keep the httpd stuff separate from the Tomcat
stuff. It's working better now, but there is one thing that I can't get
to work like I would like it to.
But first I think I need to explain a bit more about our setup. This is
what our directory structure looks like:
/www/
/htdocs/
/examples1/
/examples2/index.html
/examples3/index.jsp
/WEB-INF/web.xml
/webapps/
/webapp1/index.jsp
/webapp2/index.jsp
Now httpd is set up like this:
DocumentRoot "/www/htdocs"
Tomcat has a context configured like this:
<Context path="" docBase="/www/htdocs" debug="0" reloadable="true"/>
As you can see the ROOT context in Tomcat is the same directory as the
DocumentRoot in httpd. The reason for this setup is this:
- We want to use a couple of jsp:s in the DocumentRoot like the file
/examples3/index.jsp above. These files are managed by the same people
that write our html-pages. We don't want to let these web-writers into
the webapps-subdirectory.
I have made the change you suggested:
Removed index.jsp from the DirectoryIndex directive.
I also added the following to /www/htdocs/WEB-INF/web.xml:
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
The thing that didn't work before now works :-) , but one thing that
used to work before is now broken :-( Trying the URL:s in the directory
structure above gives these results:
- Accesses to /examples1/ (Apache httpd shows a directory listing)
- Accesses to /examples2/ (Apache httpd serves the file index.html)
- Accesses to /examples3/index.jsp (Tomcat serves the file index.jsp)
- Accesses to /examples3/ (Apache httpd shows a directory listing)
The first three work as can be expected. It's the last one that puzzles
me. I would like Tomcat to serve me the file index.jsp there. Is that
possible?
--
Dennis Lundberg
Mladen Turk wrote:
> Dennis Lundberg wrote:
>
>>
>> *Problems:*
>> With mod_jk 1.2.4 this works as expected. With versions 1.2.5, 1.2.6
>> and 1.2.8, number 3 above doesn't work. A request for /examples/
>> returns a 404 from Tomcat. Looking in the mod_jk log shows that it is
>> trying to serve the file index.jsp, but that file doesn't exist. It
>> should have returned a directory listing because no valid index-file
>> (index.jsp, index.shtml or index.html) was found.
>>
>
> Do not use DirectoryIndex index.jsp.
> It's up to Tomcat to decide what will be the default context for
> any web application.
>
>> *Configuration snippets*
>> httpd.conf
>> Options Indexes Includes
>> DirectoryIndex index.jsp index.shtml index.html
>
>
> You can serve only application that are listed in the server.xml,
> so what would be the purpose of DirectoryIndex index.jsp anyhow?
>
>> ...
>> JkMount /*.jsp connector80
>> JkMount /webapp1/* connector80
>> JkMount /webapp2/* connector80
>> ...
>>
>> We've also tried some of the new mod_jk directives forwards and
>> backwards including these:
>> JkOptions -ForwardDirectories
>> JkOptions +ForwardDirectories
>>
>> Is there something wrong with our setup, our is there a bug in mod_jk?
>
>
> Yes like said apache forwards the requests to tomcat over the wire.
> It's up to Tomcat to decide what content it will serve.
> Using DirectoryIndex the Apache is trying
> /examples/index.jsp -> 404 from Tomcat if index.jsp does not exist.
>
> This is common perception problem. Tomcat is not PHP where you can
> feed the physical file to its engine, so entire DirectoryIndexing
> concept is useless from Tomcat point of view.
>
> Mladen.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: [mod_jk] Unable to get directory listings from Apache httpd 2
for versions 1.2.5 and above
Posted by Mladen Turk <ml...@jboss.com>.
Dennis Lundberg wrote:
>
> *Problems:*
> With mod_jk 1.2.4 this works as expected. With versions 1.2.5, 1.2.6 and
> 1.2.8, number 3 above doesn't work. A request for /examples/ returns a
> 404 from Tomcat. Looking in the mod_jk log shows that it is trying to
> serve the file index.jsp, but that file doesn't exist. It should have
> returned a directory listing because no valid index-file (index.jsp,
> index.shtml or index.html) was found.
>
Do not use DirectoryIndex index.jsp.
It's up to Tomcat to decide what will be the default context for
any web application.
> *Configuration snippets*
> httpd.conf
> Options Indexes Includes
> DirectoryIndex index.jsp index.shtml index.html
You can serve only application that are listed in the server.xml,
so what would be the purpose of DirectoryIndex index.jsp anyhow?
> ...
> JkMount /*.jsp connector80
> JkMount /webapp1/* connector80
> JkMount /webapp2/* connector80
> ...
>
> We've also tried some of the new mod_jk directives forwards and
> backwards including these:
> JkOptions -ForwardDirectories
> JkOptions +ForwardDirectories
>
> Is there something wrong with our setup, our is there a bug in mod_jk?
Yes like said apache forwards the requests to tomcat over the wire.
It's up to Tomcat to decide what content it will serve.
Using DirectoryIndex the Apache is trying
/examples/index.jsp -> 404 from Tomcat if index.jsp does not exist.
This is common perception problem. Tomcat is not PHP where you can
feed the physical file to its engine, so entire DirectoryIndexing
concept is useless from Tomcat point of view.
Mladen.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org