Open
Description
I have a simple connect app setup with a proxy that points to a remote location (off server), and when I refresh the page a bunch of times really fast, I get this error: { [Error: socket hang up] code: 'ECONNRESET' }
. If it isn't caught with proxy.on('error')
, then the entire app will crash. I know this is a weird use case, and it may not be a bug at all. If so, I would appreciate it if someone could help me understand this error. According to google, the error means "the other side of the TCP conversation abruptly closed its end of the connection". I'm not sure how this relates to the proxy. I just want to make sure it won't show up if my proxy starts getting thousands of requests per second. Here is the code for my sample app:
var connect = require('connect')
var httpProxy = require('http-proxy')
var app = connect()
var proxy = httpProxy.createProxyServer()
proxy.on('error', function(e) {
console.error(e) // this is where the error is thrown
})
app.use(function(req, res, next) {
req.headers.host = HOST // to change the host header
next()
})
app.use(function(req, res) {
proxy.web(req, res, {target: REMOTE_HOST})
})
app.listen(8080)