Reputation: 11
I'm trying to redirect HTTP GET requests to a seperate web server. I could not find any example code. I configured mule.xml as below. I think there must be a better way than this. Any ideas? thanks.
<flow name="sampleInsert" doc:name="sampleInsert">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" responseTimeout="1" doc:name="HTTP" path="indb/sampleInsert" >
</http:inbound-endpoint>
<logger level="INFO" doc:name="Logger" message="In Time #[server.dateTime]"/>
<logger level="INFO" doc:name="Logger" message="Out Time #[server.dateTime]"/>
<http:outbound-endpoint address="http://www.mulesoft.org/" doc:name="HTTP" exchange-pattern="request-response" followRedirects="true" method="GET"/>
</flow>
Upvotes: 0
Views: 2620
Reputation: 11606
Thats a valid pattern but there is also an out of the box pattern for a http proxy:
http://www.mulesoft.org/documentation/display/current/HTTP+Proxy+Pattern
Or you instead you can let the client redirect by setting the http 'Location' header and 30x response code:
<flow name="testResponseMove" processingStrategy="synchronous">
<http:inbound-endpoint address="http://localhost:${port1}/resources/move" exchange-pattern="request-response"/>
<http:response-builder status="302">
<http:location value="http://localhost:9090/resources/moved"/>
</http:response-builder>
<echo-component/>
</flow>
Upvotes: 1