Open wei opened 8 years ago
Hi ddhhz, You can manipulate urls by adding another function using the use directive. ie:
var RedWire = require('redwire');
var redwire = new RedWire({
http: { port: 80 }
});
redwire.http('example.com', '127.0.0.1:3000');
manipulate = function(mount, url, req, res, next) {
if (req.url.indexOf('/testplace/') === 0) {
req.url += 'add this';
url += 'add this';
}
return redwire.proxy()(mount, url, req, res, next);
};
redwire.http('example.com/api').use(manipulate);
Hope this helps.
Cheers
Hi there,
Is there any support for post proxy middleware or response modification? I'm looking to replace urls in the response html and js files.
Thanks! ddhhz