Using .createProxy() Errors When Used
Created by: Albert-IV
From your examples on the Nodejitsu blog, the following code should redirect correctly:
var http = require('http'),
httpProxy = require('http-proxy');
var proxy = httpProxy.createProxy();
http.createServer(function(req, res) {
res.end('hi!');
}).listen(3000);
require('http').createServer(function(req, res) {
proxy.web(req, res, { target: 'http://127.0.0.1:3000' });
}).listen(8000);
When you hit http://localhost:8000, the proxy process dies with this error:
TypeError: Cannot read property 'length' of undefined
Node v0.10.24, http-proxy v1.0.0