transformer-proxy icon indicating copy to clipboard operation
transformer-proxy copied to clipboard

when adding "target" property for the http-proxy - data is not received - appear to be Buffer

Open syberkitten opened this issue 8 years ago • 0 comments

my use case is to create a proxy for the browser, which means i want to route requests through my proxy, and not to a specific proxied server.

the issue is easy to reproduce, using the promise.js example, no response is being returned, actually the data inside the transformerFunction appears to be a Buffer

//var proxy = httpProxy.createProxyServer({target: 'http://localhost:' + proxiedPort});
var proxy = httpProxy.createProxyServer({}); // we don't want to set up the target right now

app.use(transformerProxy(transformerFunction));

app.use(function (req, res) {

  var target = 'http://' + req.headers.host;
  // This is where we set the target we want
  proxy.web(req, res, {target:target});
  //proxy.web(req, res);
});

syberkitten avatar Jan 26 '17 17:01 syberkitten