Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • N node-http-proxy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 482
    • Issues 482
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 102
    • Merge requests 102
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • http ... PARTY!
  • node-http-proxy
  • Issues
  • #898
Closed
Open
Issue created Oct 23, 2015 by Administrator@rootContributor

App is crashing when the page is refreshed several times

Created by: jsonmaur

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)
Assignee
Assign to
Time tracking