Skip to content
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

return 504, 502 and 500 as appropriate Fixes #131 #132

Merged
merged 1 commit into from
Dec 7, 2016

Conversation

graingert
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 96.97% when pulling 43a2f66 on graingert:patch-1 into 100681c on chimurai:master.

@SpaceK33z
Copy link

SpaceK33z commented Dec 6, 2016

Nice, looks good. I'm wondering if this would be a breaking change. It could be breaking if someone relies on the 500 status being returned.

@graingert
Copy link
Contributor Author

@SpaceK33z not a breaking change over HTTP. The HTTP spec is very clear that servers can return these error codes, and clients should support them. Any client that does a hardcoded detection of '500' is not HTTP compliant, and should expect to be broken.

@coveralls
Copy link

coveralls commented Dec 7, 2016

Coverage Status

Coverage increased (+0.06%) to 96.97% when pulling 0627ad9 on graingert:patch-1 into 100681c on chimurai:master.

@graingert
Copy link
Contributor Author

@chimurai woop it's green now

@graingert graingert changed the title return 504 error for ENOTFOUND or ECONNREFUSED return 504, 502 and 500 as appropriate Fixes #131 Dec 7, 2016
@chimurai
Copy link
Owner

chimurai commented Dec 7, 2016

Thanks for the PR @graingert.

Definitely a better usage of the http status codes. Don't mind if this PR breaks existing hardcoded detection because of this improvement.

This defaultErrorHandler is overridable with the onError option if you want a customized error handling.

So if someone still wants to rely on the hardcoded 500 http error, they can use the onError option to achieve that.


Some background info why this default error handler exists.

From the http-proxy documentation:

proxy events
error: The error event is emitted if the request to the target fail. We do not do any error handling of messages passed between client and proxy, and messages passed between proxy and target, so it is recommended that you listen on errors and handle them.

@chimurai chimurai merged commit 32b4c06 into chimurai:master Dec 7, 2016
@chimurai
Copy link
Owner

chimurai commented Dec 7, 2016

published in v0.17.3

hope this doesn't cause much regression :)

@SpaceK33z
Copy link

Awesome @chimurai :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants