tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Townsley, Charlotte" <charlotte.towns...@eds.com>
Subject RE: Apache DirectoryIndex and mod_jk ForwardDirectories not playing nicely
Date Mon, 06 Oct 2008 17:56:47 GMT
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


Mime
View raw message