tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject RewriteRule rewrites, but mod_jk persists with old URI
Date Tue, 15 Jun 2010 13:04:01 GMT
Hi.

I have a problem at tbe border between Apache httpd's mod_rewrite and the mod_jk 
Apache/Tomcat connector.

Versions are :
Apache httpd 2.2.3
mod_jk 1.2.18
OS : Linux Debian  2.6.18-6-686 #1 SMP Thu May 8 07:34:27 UTC 2008 i686 GNU/Linux

(Not the latests versions, I know, but that's what that system has and the problem may not

be version-linked, and there is something sweet about packages which just install/upgrade

with apt-get)

The request URL I am using is
http://hostname/jsp/search.jsp

In the Apache httpd config, is the following RewriteRule :

     RewriteCond %{REQUEST_URI} ^/jsp/(.*)$
     RewriteRule ^/jsp/ /mir/%1 [PT]

OR, more simply (but with the same result at the end) :

     RewriteRule ^/jsp/(.*)$ /mir/$1 [PT]

plus a Location section as follows :

<Location /mir>
   SetHandler jakarta-servlet
</Location>

(OR the following, to the same end-effect also :
   JkMount /mir ajp13
   JkMount /mir/* ajp13
)


The above rewrite rule should rewrite /jsp/search.jsp to /mir/search.jsp
and it does, as per the mod_rewrite log :

[rid#8c06030/initial] (2) init rewrite engine with requested uri /jsp/search.jsp
[rid#8c06030/initial] (2) rewrite '/jsp/search.jsp' -> '/mir/search.jsp'
[rid#8c06030/initial] (2) forcing '/mir/search.jsp' to get passed through to next API 
URI-to-filename handler

But then, in the mod_jk log, I see this :

...
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] map_uri_to_worker::jk_uri_worker_map.c 
(508): Attempting to map URI '/mir/search.jsp' from 2 maps
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] map_uri_to_worker::jk_uri_worker_map.c 
(520): Attempting to map context URI '/mir/*'
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] map_uri_to_worker::jk_uri_worker_map.c 
(534): Found a wildchar match ajp13 -> /mir/*
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] jk_handler::mod_jk.c (1832): Into handler

jakarta-servlet worker=ajp13 r->proxyreq=0
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] wc_get_worker_for_name::jk_worker.c (111):

found a worker ajp13
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] init_ws_service::mod_jk.c (531): Service 
protocol=HTTP/1.1 method=GET host=(null) addrr=84.158.163.2 name=(hostname) port=80 
auth=(null) user=(null) laddr=192.168.245.20 raddr=84.158.163.2
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] ajp_get_endpoint::jk_ajp_common.c (2172):

acquired connection pool slot=0
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] ajp_marshal_into_msgb::jk_ajp_common.c 
(566): ajp marshaling done
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] ajp_service::jk_ajp_common.c (1706): 
processing ajp13 with 2 retries
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] 
ajp_connection_tcp_send_message::jk_ajp_common.c (909): sending to ajp13 pos=4 len=424 
max=8192
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] 
ajp_connection_tcp_send_message::jk_ajp_common.c (909): 0000    12 34 01 A4 02 02 00 08 48

54 54 50 2F 31 2E 31  - .4......HTTP/1.1
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] 
ajp_connection_tcp_send_message::jk_ajp_common.c (909): 0010    00 00 0F 2F 6A 73 70 2F 73

65 61 72 63 68 2E 6A  - .../jsp/search.j
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] 
ajp_connection_tcp_send_message::jk_ajp_common.c (909): 0020    73 70 00 00 0C 38 34 2E 31

35 38 2E 31 36 33 2E  - sp...84.158.163.
[Tue Jun 15 11:26:15 2010] [9170:30400] [debug] 
ajp_connection_tcp_send_message::jk_ajp_common.c (909): 0030    32 00 FF FF 00 17 6D 69 72

2E 64 65 76 2E 77 69  - 2.....mir.dev.wi
...

In other words, it appears to receive the URI "/mir/search.jsp", try to map it to a 
worker, succeed, but then forwarding the request to Tomcat as "/jsp/search.jsp" anyway 
(which was the original URL, not the rewritten one).
This "/jsp/search.jsp" is indeed not found by Tomcat (because in Tomcat it is 
"/mir/search.jsp"), and I receive in return a 404 error page from Tomcat.

I have tried umpteen variations for the mapping and the rewrite rule, without success.

What am I doing wrong ?
Or, was this a bug in mod_jk 1.2.18, since corrected ?
(But I find nothing that appears relevant in the Changes log at 
http://tomcat.apache.org/connectors-doc/miscellaneous/changelog.html)

Thanks




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


Mime
View raw message