Skip to content

ECONNRESET #971

Open
Open
@ronag

Description

@ronag

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions