防止分裂URI的mod-rewrite

时间:2013-04-19 16:00:23

标签: mod-rewrite

全部 -

在反向代理上,我试图自动将一个查询字符串arg附加到传入URI的末尾,而mod-rewrite似乎做了一些奇怪的事情。

如果我使用这样的规则:

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    /t/SkunkWorks/views/LabelLocalization/Dashboard$    /t/SkunkWorks/views/LabelLocalization/Dashboard\?Language=3  [L,PT]
#####Proxy Rule
ProxyRequests Off

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / http://server8/
ProxyPassReverse / http://server8/
AllowEncodedSlashes On

我看到Apache使用Fiddler推出了以下内容:

http://192.168.203.34:9089/t/SkunkWorks/views/LabelLocalization/Dashboard?Language=3

到目前为止很好。

我还看到请求到达反向代理通过的机器:

192.168.203.34 - - [19/Apr/2013:11:35:04 -0400] 80 "GET /t/SkunkWorks/views/LabelLocalization/Dashboard?Language=3 HTTP/1.1" "fe80::a53f:6156:2a22:378d, 192.168.203.34" 200 4052 "-" 109186 UXFkKMCoyx0AAAA0Q2UAAAEM

但是,在目标计算机上执行工作的应用程序(192.168.203.29)无法正确响应。它不是使用特定语言呈现报告,而是挂起。

如果我直接针对应用服务器执行http://192.168.203.29/t/SkunkWorks/views/LabelLocalization/Dashboard?Language=3,则报告呈现正常。它似乎是导致问题的重写规则。

为什么呢?我在error.log中看到了这个:

[Fri Apr 19 10:55:55.194288 2013] [rewrite:trace2] [pid 13240:tid 712] mod_rewrite.c(468): [client fe80::a53f:6156:2a22:378d:32996] fe80::a53f:6156:2a22:378d - - [simpleprime/sid#982130][rid#dbcd50/initial] init rewrite engine with requested uri /t/SkunkWorks/views/LabelLocalization/Dashboard
[Fri Apr 19 10:55:55.194288 2013] [rewrite:trace3] [pid 13240:tid 712] mod_rewrite.c(468): [client fe80::a53f:6156:2a22:378d:32996] fe80::a53f:6156:2a22:378d - - [simpleprime/sid#982130][rid#dbcd50/initial] applying pattern '/t/SkunkWorks/views/LabelLocalization/Dashboard$' to uri '/t/SkunkWorks/views/LabelLocalization/Dashboard'
[Fri Apr 19 10:55:55.194288 2013] [rewrite:trace2] [pid 13240:tid 712] mod_rewrite.c(468): [client fe80::a53f:6156:2a22:378d:32996] fe80::a53f:6156:2a22:378d - - [simpleprime/sid#982130][rid#dbcd50/initial] rewrite '/t/SkunkWorks/views/LabelLocalization/Dashboard' -> '/t/SkunkWorks/views/LabelLocalization/Dashboard?Language=3[L,PT]'
RIGHT HERE ->>>>[Fri Apr 19 10:55:55.194288 2013] [rewrite:trace3] [pid 13240:tid 712] mod_rewrite.c(468): [client fe80::a53f:6156:2a22:378d:32996] fe80::a53f:6156:2a22:378d - - [simpleprime/sid#982130][rid#dbcd50/initial] split uri=/t/SkunkWorks/views/LabelLocalization/Dashboard?Language=3[L,PT] -> uri=/t/SkunkWorks/views/LabelLocalization/Dashboard, args=Language=3[L,PT]**

如果我简化规则并删除?language = 3,那么事情就会很好:

RewriteRule    /t/SkunkWorks/views/LabelLocalization/Dashboard$    /t/SkunkWorks/views/LabelLocalization/Dashboard  [L,PT]

我可以用

命中反向代理
http://192.168.203.34/t/SkunkWorks/views/LabelLocalization/Dashboard?Language=3

...它正确地传递到192.168.203.29框。机器按原样呈现报告。

我猜测“URI SPLIT”是造成问题的原因...因为当我在error.log中没有看到它时,事情就会起作用,而且当我这样做时它们会中断。

我可以做些什么来阻止URI拆分?

0 个答案:

没有答案