nitoyon/livereloadx

Crashes in proxy mode when upstream server is not running

Opened this issue · 0 comments

First of all, thanks a lot for providing this great tool!

When running in proxy mode, if the upstream server is not running during a request livereloadx crashes: it prints the error message below, the process keeps running but the proxy is not responding to requests any more.

Steps to reproduce (port 1 is just an example, no server should be bound to it):

  1. Run livereloadx -p 3000 -y http://localhost:1
  2. In a second terminal, run curl http://localhost:3000/foo

Error message (base path replaced with ...):

2016-02-20 11:23:10 - info:  ::1 - "GET /foo HTTP/1.1" 500 -
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at ServerResponse.OutgoingMessage.write (_http_outgoing.js:426:15)
    at ServerResponseWrapper.write (.../node_modules/livereloadx/lib/proxy.js:55:20)
    at Socket.proxyError (.../node_modules/livereloadx/node_modules/http-proxy/lib/node-http-proxy/http-proxy.js:204:13)
    at Socket.g (events.js:273:16)
    at emitOne (events.js:95:20)
    at Socket.emit (events.js:182:7)
    at emitErrorNT (net.js:1246:8)
    at nextTickCallbackWith2Args (node.js:475:9)
    at process._tickCallback (node.js:389:17)