首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >WSO2ESB简单传递代理不转发url扩展

WSO2ESB简单传递代理不转发url扩展
EN

Stack Overflow用户
提问于 2014-06-04 14:49:46
回答 2查看 241关注 0票数 0

我通过代理实现了一个简单的传递,即当我调用

代码语言:javascript
运行
复制
   "http://wso2esb:9443/services/proxy"  

它应将请求转发给

代码语言:javascript
运行
复制
 "http://destinationserver:80/" . 

问题是在转发时未携带url扩展。即

代码语言:javascript
运行
复制
  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

代码语言:javascript
运行
复制
  <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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-06-05 09:50:45

如果你真的需要这样做,实现你的目标的一种方法(不确定这是最好的)是:

代码语言:javascript
运行
复制
<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

票数 0
EN

Stack Overflow用户

发布于 2014-06-05 14:21:03

事情按照Jeans的回答工作,但是Htttp请求除了返回400坏请求外,不会被转发。使用目标服务器上的直接链接进行测试将返回预期的响应。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24040710

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档