New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Invalid status code: 0 #95

Closed
Rob--W opened this Issue Nov 8, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@Rob--W
Owner

Rob--W commented Nov 8, 2017

The public demo server has been failing intermittently.

When I watch the logs ( ./node_modules/.bin/heroku logs --app cors-anywhere ), I see the following error at some point, after which the server is unavailable for a while (before it is automatically restarted).

2017-11-08T17:40:51.959869+00:00 app[web.1]: _http_server.js:192
2017-11-08T17:40:51.959871+00:00 app[web.1]:     throw new RangeError(`Invalid status code: ${statusCode}`);
2017-11-08T17:40:51.900841+00:00 heroku[router]: at=info method=GET path="/[HTTP URL REDACTED]" host=cors-anywhere.herokuapp.com request_id=a24e02a6-7a22-4cc6-8ea4-057afd0ab5bc fwd="[IP ADDRESS REDACTED]" dyno=web.1 connect=0ms service=242ms status=429 bytes=467 protocol=https
2017-11-08T17:40:51.959872+00:00 app[web.1]:     ^
2017-11-08T17:40:51.959873+00:00 app[web.1]: 
2017-11-08T17:40:51.959874+00:00 app[web.1]: RangeError: Invalid status code: 0
2017-11-08T17:40:51.959875+00:00 app[web.1]:     at ServerResponse.writeHead (_http_server.js:192:11)
2017-11-08T17:40:51.959876+00:00 app[web.1]:     at Array.writeStatusCode (/app/node_modules/http-proxy/lib/http-proxy/passes/web-outgoing.js:99:9)
2017-11-08T17:40:51.959877+00:00 app[web.1]:     at ClientRequest.<anonymous> (/app/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:149:20)
2017-11-08T17:40:51.959877+00:00 app[web.1]:     at emitOne (events.js:90:13)
2017-11-08T17:40:51.959878+00:00 app[web.1]:     at ClientRequest.emit (events.js:182:7)
2017-11-08T17:40:51.959879+00:00 app[web.1]:     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:469:21)
2017-11-08T17:40:51.959880+00:00 app[web.1]:     at HTTPParser.parserOnHeadersComplete (_http_common.js:103:23)
2017-11-08T17:40:51.959881+00:00 app[web.1]:     at TLSSocket.socketOnData (_http_client.js:359:20)
2017-11-08T17:40:51.959882+00:00 app[web.1]:     at emitOne (events.js:90:13)
2017-11-08T17:40:51.959886+00:00 app[web.1]:     at TLSSocket.emit (events.js:182:7)

@Rob--W Rob--W added the bug label Nov 8, 2017

@Rob--W

This comment has been minimized.

Owner

Rob--W commented Nov 8, 2017

This particular crash has been observed before in the library that I use: nodejitsu/node-http-proxy#1080

@Rob--W Rob--W closed this Nov 11, 2017

Rob--W added a commit that referenced this issue Dec 1, 2017

Version 0.4.1
- Add ability to rate-limit/block requests by origin (#45).
- Avoid crashing on invalid HTTP status codes (#95).
- Support and test coverage for latest Node.js versions (up to 9).
- Support `Access-Control-Max-Age` via `corsMaxAge` option.
- Listen on `0.0.0.0:8080` by default instead of `127.0.0.1:8080`.
  (use `HOST` and `PORT` environment variables to override this).
- Update gTLD list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment