简体   繁体   中英

WSO2ESB Simple Passthrough Proxy doesnt forward the url extensions

I implemented a simple pass through proxy ie when i call

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

it should forward the request to

 "http://destinationserver:80/" . 

The question is the url extensions are not carried while forwarding.. ie

  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?

My 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>

Thanks in advance!

PS: my WSO2ESB version : 4.8.1

If you really need that, one way (not sure this is the best) to achieve your goal would be :

<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>

Send a post request to http://wso2esb:8280/services/proxy/path1/path2 and it should be forwarded to http://destinationserver:80/path1/path2

Things worked as per Jeans answer but Htttp HEAD request is not forwarded except it is returning 400 Bad Request. Testing with direct link on the destination server returns expected response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM