Apache mod_proxy url编码 [英] Apache mod_proxy url encoding
本文介绍了Apache mod_proxy url编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个REST服务,它接受格式为/{parameter}
I have a REST service that accepts parameters in a form /{parameter}
还有Apache2将请求转发到Web服务
Also there is Apache2 that forwards requests to the websevice
<VirtualHost *:9091>
AllowEncodedSlashes NoDecode
LogLevel debug
ProxyPass /webservice balancer://api/webservice
<Proxy balancer://api>
BalancerMember http://localhost:8030
</Proxy>
</VirtualHost>
参数可能包含编码字符,例如%2f(/)
Parameters may contain encoded characters, like %2f (/)
问题是Apache再次对这些字符进行了编码,并且Webservice接收了%252F而不是%2F
The problem is that Apache encodes these characters again, and Webservice receives %252F instead of %2F
[Mon Oct 15 13:59:24 2012] [debug] mod_proxy_balancer.c(46): proxy: BALANCER: canonicalising URL //api/webservice/Interface GigabitEthernet1%2F0%2F2
[Mon Oct 15 13:59:24 2012] [debug] mod_proxy_balancer.c(581): proxy: BALANCER (balancer://api) worker (http://localhost:8030) rewritten to http://localhost:8030/Interface%20GigabitEthernet1%252F0%252F2%20Utilization
如果我直接请求Web服务,则Tomcat/Jetty会处理它的查找,并且服务会收到正确的参数.
If I request the webservice directtly, Tomcat/Jetty handles it find and service receives correct parameter.
推荐答案
通过指定
ProxyPass /webservice balancer://api/webservice nocanon
这篇关于Apache mod_proxy url编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文