node-http-proxy icon indicating copy to clipboard operation
node-http-proxy copied to clipboard

ECONNRESET

Open ronag opened this issue 10 years ago • 3 comments

I don't understand why I keep getting ECONNRESET with this rather simple proxy:

import httpProxy from 'http-proxy'
import http from 'http'

const proxy = httpProxy.createProxyServer({})

const server = http.createServer((req, res) => {
  console.log(req.url)
  if (req.url.startsWith('/media') || req.url.startsWith('/scene')) {
    proxy.web(req, res, { target: 'http://127.0.0.1:8001' }, err => {
      if (err) {
        console.error(err)
      }
    })
  } else if (req.url.startsWith('/authenticate')) {
    proxy.web(req, res, { target: 'http://127.0.0.1:4223' }, err => {
      if (err) {
        console.error(err)
      }
    })
  } else {
    proxy.web(req, res, { target: 'http://127.0.0.1:9966' }, err => {
      if (err) {
        console.error(err)
      }
    })
  }
})

http.globalAgent.maxSockets = Infinity
server.timeout = 3 * 60 * 60 * 1000 // 3 hours
server.listen(8080)

Not going through the proxy works perfectly.

node-proxy: 1.13.2 node: 5.5.0

ronag avatar Mar 07 '16 18:03 ronag

Hi !

I have a same probleme on the specific case ! I upload on my serveur, behind the http-proxy, a large file (250Mo) with a slow connexion 64kb ! And in the specific case, i have a ECONNRESET error ! Without a slow connexion, it's works ! Initially, I thought it was nodejs. So i try all versions and the problem is appear in versin 3.3.0 (iojs) and later (4.x 5.x, so nodejs too). But the manipulation (upload) work without the proxy !

Regards

http-proxy : 1.13.2 node : > 3.3.0 OS linux 3.9.11

Toon34 avatar Mar 11 '16 12:03 Toon34

Hi !

Should be fixed by https://github.com/nodejs/node/pull/6284

Toon34 avatar Apr 29 '16 13:04 Toon34

I am getting a similar error for large file uploads or slow internet connections. Seems to timeout at exactly the 5 minute mark. I ripped out this component and tried with a simple golang reverse proxy and did not hit the same issue so I believe it is this package causing the issue. My express server has a timeout set to 0 and I tried messing with the proxyTimeout and timeout options of this package to no avail.

Is this package still maintained? Seems like the last commit was three years ago and the issues are pilling up.

aliotta avatar Sep 26 '23 16:09 aliotta