WSO2ESB Simple Passthrough Proxy不转发url扩展名

时间:2014-06-04 14:49:46

标签: proxy wso2 wso2esb

我实现了一个简单的代理传递,即当我打电话

   "http://wso2esb:9443/services/proxy"  

它应该将请求转发给

 "http://destinationserver:80/" . 

问题是转发时不会进行网址扩展..即

  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

2 个答案:

答案 0 :(得分:0)

如果你真的需要,那么实现目标的一种方式(不确定这是最好的)将是:

<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发送帖子请求,并将其转发至http://destinationserver:80/path1/path2

答案 1 :(得分:0)

按照牛仔裤回答的方式工作但Htttp HEAD请求不会被转发,除非它返回400 Bad Request。在目标服务器上使用直接链接进行测试会返回预期的响应。