My code:
var path = require('path');
var util = require('util');
var http = require('http');
var fs = require('fs');
var httpProxy = require('http-proxy');
httpProxy.createProxyServer({
target: 'http://localhost:9000',
agent: https.globalAgent,
headers: {
host: 'localhost'
}
})
.listen(8000);
util.puts('proxy server listening on port 8000');
http.createServer(function targetServer(req, res) {
res.writeHead(302, { 'Location': '/' }); //Here is the 302
util.puts('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
res.end();
})
.listen(9000);
util.puts('target server listening on port 9000');
when I make the request from my browser i get the following error:
Error: socket hang up
I have no idea what this error means. Can anyone help me figure this out?