title: WSO2 API Manager - Replace URLs in response body
body: <p>I'm trying to setup a proxy for my RESTful API using WSO2 API Manager. My problem is that the responses from the backend API are left untouched so all the urls that connect to other endpoints still reference the backend server rather than the proxy. I need a way to replace those url values in the response body to point to the proxied api. I understand this can be accomplished via <a href="https://docs.wso2.org/display/AM160/Adding+a+Mediation+Extension" rel="nofollow">Mediation Extensions</a>, using <a href="https://docs.wso2.org/display/ESB480/Mediators" rel="nofollow">ESB Mediators</a>.</p>
  
  <p>I'm not familiar enough with them to pick the one better suited for the job. <a href="https://docs.wso2.org/display/ESB480/URLRewrite+Mediator" rel="nofollow">URLRewrite</a> mediator looks pretty straightforward, but it doesn't seem to apply to the message body but the headers. <a href="https://docs.wso2.org/display/ESB480/PayloadFactory+Mediator" rel="nofollow">Payload Factory</a> seems to require a fixed structure for the message, which is not very convenient for me, since I need it to work on the different responses that my API provides (and I wouldn't want to maintain those structures in the mediator definition).</p>