我通过代理实现了一个简单的传递,即当我调用
"http://wso2esb:9443/services/proxy"
它应将请求转发给
"http://destinationserver:80/" .
问题是在转发时未携带url扩展。即
when i do a HTTP POST in
http://wso2esb:9443/services/proxy/path1/path2
the request is forwarded to
http://destinationserver:80
rather than to
http://destinationserver:80/path1/path2.
but HTTP GET behaves as expected. Could anyone help in where i am going wrong?
我的Proxy.xml
<proxy xmlns="http://ws.apache.org/ns/synapse" name="proxy" transports="https,http"
statistics="disable" trace="disable" startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="http://destinationserver:80/"/>
</endpoint>
</target>
<description/>
</proxy>
提前感谢!
P.S:我的WSO2ESB版本: 4.8.1
发布于 2014-06-05 09:50:45
如果你真的需要这样做,实现你的目标的一种方法(不确定这是最好的)是:
<proxy xmlns="http://ws.apache.org/ns/synapse" name="proxy" transports="https,http"
statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<header name="To"
expression="concat('http://destinationserver:80',substring-after(syn:get-property('To'),'/services/proxy'))"/>
<send/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<description/>
</proxy>
向http://wso2esb:8280/services/proxy/path1/path2
发送一个post请求,并将其转发给http://destinationserver:80/path1/path2
发布于 2014-06-05 14:21:03
事情按照Jeans的回答工作,但是Htttp请求除了返回400坏请求外,不会被转发。使用目标服务器上的直接链接进行测试将返回预期的响应。
https://stackoverflow.com/questions/24040710
复制相似问题