我们有Apache 2.4通过mod_jk面向Tomcat。
当请求像" /abc/def/ghi/e380297.rhd"获取提交mod_rewrite预先设置Web应用程序上下文路径" web"结果是" /web/abc/def/ghi/e380297.rhd"。之后,请求正确传递给Tomcat。
但是,只要在URL的任何路径段中插入分号,例如" / abc / de; f / ghi / e380297.rhd",然后Apache不会将请求传递给Tomcat,而是尝试查找资源本身。由于它不存在(AH00128:文件不存在),它将返回404.
mod_rewrite.c(475): [client 10.129.76.100:64002] 10.129.76.100 - - [x/sid#15e65d8][rid#405d670/initial] init rewrite engine with requested uri /abc/de;f/ghi/e380297.rhd
mod_rewrite.c(475): [client 10.129.76.100:64002] 10.129.76.100 - - [x/sid#15e65d8][rid#405d670/initial] applying pattern '^/(.*)' to uri '/abc/de;f/ghi/e380297.rhd'
mod_rewrite.c(475): [client 10.129.76.100:64002] 10.129.76.100 - - [x/sid#15e65d8][rid#405d670/initial] RewriteCond: input='/abc/de;f/ghi/e380297.rhd' pattern='!^/web/.*$' => matched
mod_rewrite.c(475): [client 10.129.76.100:64002] 10.129.76.100 - - [x/sid#15e65d8][rid#405d670/initial] RewriteCond: input='/abc/de;f/ghi/e380297.rhd' pattern='!^/content/.*$' => matched
mod_rewrite.c(475): [client 10.129.76.100:64002] 10.129.76.100 - - [x/sid#15e65d8][rid#405d670/initial] rewrite '/abc/de;f/ghi/e380297.rhd' -> '/web/abc/de;f/ghi/e380297.rhd'
mod_rewrite.c(475): [client 10.129.76.100:64002] 10.129.76.100 - - [x/sid#15e65d8][rid#405d670/initial] forcing '/web/abc/de;f/ghi/e380297.rhd' to get passed through to next API URI-to-filename handler
mod_authz_core.c(802): [client 10.129.76.100:64002] AH01626: authorization result of Require all granted: granted
mod_authz_core.c(802): [client 10.129.76.100:64002] AH01626: authorization result of <RequireAny>: granted
request.c(238): [client 10.129.76.100:64002] request authorized without authentication by access_checker_ex hook: /web/abc/de;f/ghi/e380297.rhd
client 10.129.76.100:64002] AH00128: File does not exist: /xxx/webroot/webapps/web/abc/de;f/ghi/e380297.rhd
...
http_filters.c(1008): [client 10.129.76.100:64002] Response sent with status 404, headers:
为什么Apache的行为如此,我该怎么做才能纠正这个问题?
修改
我查看了mod_jk日志文件,发现:
[debug] jk_map_to_storage::mod_jk.c (3798): no match for /web/abc/de;f/ghi/e380297.rhd found
所以看起来Apache正在将请求传递给mod_jk,但是mod_jk找不到映射,这对我来说很奇怪,因为我们已经定义了一个mount:
JkMount /*.rhd ajp13
当我使用以下网址时更加有趣
/abc/de.rhd;f/ghi/e380297.rhd
请求被传递给Tomcat。
所以mod_jk正确地将分号视为路径参数的开头(参见http://doriantaylor.com/policy/http-url-path-parameter-syntax),但是下一个&#34; /&#34;不会启动mod_jk的下一个路径段(不确定这是正确还是不正确),因此它永远不会看到URL在已挂载的扩展名中结束&#34; .rhd&#34;。