You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Townsley, Charlotte" <ch...@eds.com> on 2008/10/03 02:17:44 UTC

Apache DirectoryIndex and mod_jk ForwardDirectories not playing nicely

 
 
I'm trying to configure mod_jk 1.2.16.with Apache 1.3.26 and tomcat 5.0.28 on Solaris 9. I compiled the mod_jk from source for the Apache version. Unfortunately, I'm stuck with this environment. 
 
Behavior with mod_jk ForwardDirectories:
 
When index.shtml exists

*	
	GOOD http://www.domain.com/EDS/index.shtml -> Loads as desired
*	
	GOOD http://www.domain.com/EDS/index.page  -> Loads as desired
*	
	FAIL http://www.domain.com/EDS -> Pulls index.page from Tomcat, ignoring Apache DirectoryIndex
*	
	FAIL http://www.domain.com/EDS/ -> Pulls index.page from Tomcat, ignoring Apache DirectoryIndex
*	
	FAIL http://www.domain.com/ -> Displays Tomcat site chooser, ignoring Apache DirectoryIndex (which would display EDS/index.shtml) 

And now when index.shtml does not exist

*	GOOD http://www.domain.com/EDS -> Pulls index.page from Tomcat, ignoring Apache DirectoryIndex 
*	GOOD http://www.domain.com/EDS/ -> Pulls index.page from Tomcat, ignoring Apache DirectoryIndex 
*	GOOD http://www.domain.com/ -> Displays Tomcat site chooser, ignoring Apache DirectoryIndex (which would display EDS/index.shtml)


Behavior without mod_jk ForwardDirectories option:
 
When index.shtml exists

*	
	GOOD http://www.domain.com/EDS/index.shtml -> Loads as desired
*	
	GOOD http://www.domain.com/EDS/index.page  -> Loads as desired
*	
	GOOD http://www.domain.com/EDS -> Pulls index.shtml from Apache DirectoryIndex
*	
	GOOD http://www.domain.com/EDS/ -> Pulls index.shtml from Apache DirectoryIndex
*	
	GOOD http://www.domain.com/ -> Displays /EDS/index.shtml

And now when index.shtml does not exist

*	
	FAIL http://www.domain.com/EDS -> Apache Access Denied error (does not send request for directory "EDS" to Tomcat)
*	
	FAIL http://www.domain.com/EDS/ -> Apache Access Denied error (does not send request for directory "EDS" to Tomcat)
*	
	FAIL http://www.domain.com/ -> Apache Access Denied error (does not send request for directory "EDS" to Tomcat)

Relevant apache configuration:
LoadModule jk_module libexec/mod_jk.so.0.0.0
JkWorkersFile /cust/IBMHttpServer/conf/jk/worker.properties
JkShmFile       /cust/IBMHttpServer/logs/mod_jk.shm
JkLogFile        /cust/IBMHttpServer/logs/mod_jk.log
JkLogLevel      debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount  /*.page ajp13
JkOptions +ForwardDirectories
 
<VirtualHost 10.10.10.10:80>
DocumentRoot /cust/IBMHttpServer/htdocs/data
ServerName www.domain.com
ScriptAlias /cgi-bin /cust/IBMHttpServer/cgi-bin
DirectoryIndex /EDS/index.shtml
CheckSpelling off
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
JkMount  /*.page ajp13
</VirtualHost>
 
 
mod_jk.log log entries for a request '/EDS/' when 'index.shtml' should be displayed from the Apache DocumentRoot:
 
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] map_uri_to_worker::jk_uri_worker_map.c (682): Attempting to map URI '/EDS/' from 1 maps
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] find_match::jk_uri_worker_map.c (503): Attempting to map context URI '/*.page=ajp13' source 'JkMount'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] jk_translate::mod_jk.c (2868): no match for /EDS/ found
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] map_uri_to_worker::jk_uri_worker_map.c (682): Attempting to map URI '/EDS/index.shtml' from 1 maps
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] find_match::jk_uri_worker_map.c (503): Attempting to map context URI '/*.page=ajp13' source 'JkMount'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] jk_translate::mod_jk.c (2868): no match for /EDS/index.shtml found
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] jk_fixups::mod_jk.c (2947): ForwardDirectories on: /EDS/
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] map_uri_to_worker::jk_uri_worker_map.c (682): Attempting to map URI '/EDS/' from 1 maps
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] find_match::jk_uri_worker_map.c (503): Attempting to map context URI '/*.page=ajp13' source 'JkMount'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] jk_translate::mod_jk.c (2772): Manual configuration for /EDS/ ajp13
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] wc_get_worker_for_name::jk_worker.c (115): found a worker ajp13
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] wc_maintain::jk_worker.c (323): Maintaining worker ajp13
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] wc_get_name_for_type::jk_worker.c (292): Found worker type 'ajp13'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] init_ws_service::mod_jk.c (865): Service protocol=HTTP/1.1 method=GET host=(null) addr=71.245.103.180 n
ame=www.domain.com port=80 auth=(null) user=(null) laddr=10.5.128.143 raddr=10.20.20.20 uri=/EDS/
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] ajp_get_endpoint::jk_ajp_common.c (2579): acquired connection pool slot=0
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] ajp_marshal_into_msgb::jk_ajp_common.c (553): ajp marshaling done
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] ajp_service::jk_ajp_common.c (2050): processing ajp13 with 2 retries
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] ajp_connection_tcp_send_message::jk_ajp_common.c (934): sending to ajp13 pos=4 len=411 max=8192
 
Does anyone have any ideas? I tried increasing the Apache log level to debug, thinking it could be a mod_dir problem, but there was no additional logging output. 

RE: Apache DirectoryIndex and mod_jk ForwardDirectories not playing nicely

Posted by "Townsley, Charlotte" <ch...@eds.com>.
Hello all, 

I haven't received any replies, probably because I didn't explain the
problem very clearly. 
 
I created a "band aid" for the problem I encountered with mod_jk and
apache not handling DirectoryIndex correctly.  Essentially I used
mod_rewrite to check for index.shtml and pass to index.page when needed.


If anyone has any other ideas, please let me know. This is not my area
of expertise. 


Here is what I did with mod_rewrite:
__________________________________________
These two lines are the existing mod rewrites.  It just disables TRACE
and TRACK HTTP methods as a security precaution.

RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
____________________________________________
These next three are for directory requests:
  line 1: if DocRoot/Requested-File is a directory
  line 2: and if DocRoot/Requested-Directory does not contain
index.shtml
  line 3: rewrite request to Requested-Directory/index.page
 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}//index.shtml !-f
RewriteRule / %{REQUEST_URI}index.page [L,NC,QSA,R=301]

______________________________________________
And these two handle the default document when index.shtml does not
exist.
  line 1: if DocRoot/EDS/index.shtml does not exist
  line 2: and request is "/", then rewrite request for "EDS/index.page" 
 
RewriteCond %{DOCUMENT_ROOT}/EDS/index.shtml !-f
RewriteRule ^/$ %{REQUEST_URI}EDS/index.page [L,NC,QSA,R=301]
 
______________________________________________

The downside for this is our virtual Host entries have grown with the
addition of the rules.  
 
<VirtualHost 10.5.128.143:80>
 ServerAdmin admin@domain.com
 DocumentRoot /cust/IBMHttpServer/htdocs/egov
 ServerName www.domain.us
 ScriptAlias /cgi-bin /cust/IBMHttpServer/cgi-bin
 DirectoryIndex /EDS/index.shtml
 CheckSpelling off
 RewriteEngine on
 RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
 RewriteRule .* - [F]
 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
 RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}//index.shtml !-f
 RewriteRule / %{REQUEST_URI}index.page [L,NC,QSA,R=301]
 RewriteCond %{DOCUMENT_ROOT}/EDS/index.shtml !-f
 RewriteRule ^/$ %{REQUEST_URI}EDS/index.page [L,NC,QSA,R=301]
 JkMount  /*.page ajp13
 JkOptions -ForwardDirectories
</VirtualHost>

Charlotte Townsley
Information Analyst - Web Developer 



-----Original Message-----
From: Townsley, Charlotte [mailto:charlotte.townsley@eds.com] 
Sent: Thursday, October 02, 2008 5:18 PM
To: users@tomcat.apache.org
Subject: Apache DirectoryIndex and mod_jk ForwardDirectories not playing
nicely

 
 
I'm trying to configure mod_jk 1.2.16.with Apache 1.3.26 and tomcat
5.0.28 on Solaris 9. I compiled the mod_jk from source for the Apache
version. Unfortunately, I'm stuck with this environment. 
 
Behavior with mod_jk ForwardDirectories:
 
When index.shtml exists

*	
	GOOD http://www.domain.com/EDS/index.shtml -> Loads as desired
*	
	GOOD http://www.domain.com/EDS/index.page  -> Loads as desired
*	
	FAIL http://www.domain.com/EDS -> Pulls index.page from Tomcat,
ignoring Apache DirectoryIndex
*	
	FAIL http://www.domain.com/EDS/ -> Pulls index.page from Tomcat,
ignoring Apache DirectoryIndex
*	
	FAIL http://www.domain.com/ -> Displays Tomcat site chooser,
ignoring Apache DirectoryIndex (which would display EDS/index.shtml) 

And now when index.shtml does not exist

*	GOOD http://www.domain.com/EDS -> Pulls index.page from Tomcat,
ignoring Apache DirectoryIndex 
*	GOOD http://www.domain.com/EDS/ -> Pulls index.page from Tomcat,
ignoring Apache DirectoryIndex 
*	GOOD http://www.domain.com/ -> Displays Tomcat site chooser,
ignoring Apache DirectoryIndex (which would display EDS/index.shtml)


Behavior without mod_jk ForwardDirectories option:
 
When index.shtml exists

*	
	GOOD http://www.domain.com/EDS/index.shtml -> Loads as desired
*	
	GOOD http://www.domain.com/EDS/index.page  -> Loads as desired
*	
	GOOD http://www.domain.com/EDS -> Pulls index.shtml from Apache
DirectoryIndex
*	
	GOOD http://www.domain.com/EDS/ -> Pulls index.shtml from Apache
DirectoryIndex
*	
	GOOD http://www.domain.com/ -> Displays /EDS/index.shtml

And now when index.shtml does not exist

*	
	FAIL http://www.domain.com/EDS -> Apache Access Denied error
(does not send request for directory "EDS" to Tomcat)
*	
	FAIL http://www.domain.com/EDS/ -> Apache Access Denied error
(does not send request for directory "EDS" to Tomcat)
*	
	FAIL http://www.domain.com/ -> Apache Access Denied error (does
not send request for directory "EDS" to Tomcat)

Relevant apache configuration:
LoadModule jk_module libexec/mod_jk.so.0.0.0 JkWorkersFile
/cust/IBMHttpServer/conf/jk/worker.properties
JkShmFile       /cust/IBMHttpServer/logs/mod_jk.shm
JkLogFile        /cust/IBMHttpServer/logs/mod_jk.log
JkLogLevel      debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount  /*.page ajp13
JkOptions +ForwardDirectories
 
<VirtualHost 10.10.10.10:80>
DocumentRoot /cust/IBMHttpServer/htdocs/data ServerName www.domain.com
ScriptAlias /cgi-bin /cust/IBMHttpServer/cgi-bin DirectoryIndex
/EDS/index.shtml CheckSpelling off RewriteEngine on RewriteCond
%{REQUEST_METHOD} ^(TRACE|TRACK) RewriteRule .* - [F] JkMount  /*.page
ajp13 </VirtualHost>
 
 
mod_jk.log log entries for a request '/EDS/' when 'index.shtml' should
be displayed from the Apache DocumentRoot:
 
[Thu Oct 02 17:05:37 2008] [24767:0] [debug]
map_uri_to_worker::jk_uri_worker_map.c (682): Attempting to map URI
'/EDS/' from 1 maps [Thu Oct 02 17:05:37 2008] [24767:0] [debug]
find_match::jk_uri_worker_map.c (503): Attempting to map context URI
'/*.page=ajp13' source 'JkMount'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] jk_translate::mod_jk.c
(2868): no match for /EDS/ found [Thu Oct 02 17:05:37 2008] [24767:0]
[debug] map_uri_to_worker::jk_uri_worker_map.c (682): Attempting to map
URI '/EDS/index.shtml' from 1 maps [Thu Oct 02 17:05:37 2008] [24767:0]
[debug] find_match::jk_uri_worker_map.c (503): Attempting to map context
URI '/*.page=ajp13' source 'JkMount'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] jk_translate::mod_jk.c
(2868): no match for /EDS/index.shtml found [Thu Oct 02 17:05:37 2008]
[24767:0] [debug] jk_fixups::mod_jk.c (2947): ForwardDirectories on:
/EDS/ [Thu Oct 02 17:05:37 2008] [24767:0] [debug]
map_uri_to_worker::jk_uri_worker_map.c (682): Attempting to map URI
'/EDS/' from 1 maps [Thu Oct 02 17:05:37 2008] [24767:0] [debug]
find_match::jk_uri_worker_map.c (503): Attempting to map context URI
'/*.page=ajp13' source 'JkMount'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] jk_translate::mod_jk.c
(2772): Manual configuration for /EDS/ ajp13 [Thu Oct 02 17:05:37 2008]
[24767:0] [debug] wc_get_worker_for_name::jk_worker.c (115): found a
worker ajp13 [Thu Oct 02 17:05:37 2008] [24767:0] [debug]
wc_maintain::jk_worker.c (323): Maintaining worker ajp13 [Thu Oct 02
17:05:37 2008] [24767:0] [debug] wc_get_name_for_type::jk_worker.c
(292): Found worker type 'ajp13'
[Thu Oct 02 17:05:37 2008] [24767:0] [debug] init_ws_service::mod_jk.c
(865): Service protocol=HTTP/1.1 method=GET host=(null)
addr=71.245.103.180 n ame=www.domain.com port=80 auth=(null) user=(null)
laddr=10.5.128.143 raddr=10.20.20.20 uri=/EDS/ [Thu Oct 02 17:05:37
2008] [24767:0] [debug] ajp_get_endpoint::jk_ajp_common.c (2579):
acquired connection pool slot=0 [Thu Oct 02 17:05:37 2008] [24767:0]
[debug] ajp_marshal_into_msgb::jk_ajp_common.c (553): ajp marshaling
done [Thu Oct 02 17:05:37 2008] [24767:0] [debug]
ajp_service::jk_ajp_common.c (2050): processing ajp13 with 2 retries
[Thu Oct 02 17:05:37 2008] [24767:0] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (934): sending to ajp13
pos=4 len=411 max=8192
 
Does anyone have any ideas? I tried increasing the Apache log level to
debug, thinking it could be a mod_dir problem, but there was no
additional logging output. 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Apache DirectoryIndex and mod_jk ForwardDirectories not playing nicely

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlotte,

> I'm trying to configure mod_jk 1.2.16.with Apache 1.3.26 and tomcat
> 5.0.28 on Solaris 9. I compiled the mod_jk from source for the Apache
> version. Unfortunately, I'm stuck with this environment.

Ouch. Thanks for pointing out that you are stuck, as I'm sure a lot of
folks (including me) would say "wow, that environment is outdated and
you should really upgrade".

You should be aware that Tomcat 5.0 is now no longer supported at all
(though the other components are supported at various patch levels...
upgrading to httpd 1.3.41 would be a good idea, though).

> <VirtualHost 10.10.10.10:80>
> DocumentRoot /cust/IBMHttpServer/htdocs/data
> ServerName www.domain.com
> ScriptAlias /cgi-bin /cust/IBMHttpServer/cgi-bin
> DirectoryIndex /EDS/index.shtml

This is a very odd configuration. Check
http://httpd.apache.org/docs/1.3/mod/mod_dir.html#directoryindex for
configuration syntax. I think that having a / in the DirectoryIndex file
is contributing to the confusion. Are you attempting to set the file
that is served for http://www.domain.com/any/path/that/might/be/there/
to instead serve /EDS/index.shtml? I think you want to do that with
either 'Redirect' or 'Rewrite', not by using DirectoryIndex.

> RewriteEngine on
> RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
> RewriteRule .* - [F]

Note that this can be done with simpler <Limit> configuration, and
mod_rewrite is kind of a beast.

> JkOptions +ForwardDirectories

You may need to repeat this in your VirtualHost. Note that Tomcat only
gets a crack at the directory request if httpd doesn't find anything.
So, if the request is being served by Tomcat, then your apache httpd
configuration is broken. Why do you want Tomcat serving these
directories, anyway?

> Does anyone have any ideas? I tried increasing the Apache log level
> to debug, thinking it could be a mod_dir problem, but there was no
> additional logging output.
I'm not sure I really understand what you're trying to accomplish. I see
what the configuration is trying to do, but maybe if I understood what
you were really trying to do, I might be able offer a more natural solution.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjqacoACgkQ9CaO5/Lv0PA4kQCfS3oABTbgUVpLpPOYIChthlIT
GlMAoL1cXDEJEJDkcdn5LBxF++x07osW
=SPdJ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org