Skip to content

Send proper error response upon proxy error - #588

Merged
gaearon merged 5 commits into
react:masterfrom
cloudmu:master
Sep 5, 2016
Merged

Send proper error response upon proxy error#588
gaearon merged 5 commits into
react:masterfrom
cloudmu:master

Conversation

@cloudmu

Copy link
Copy Markdown
Contributor

Currently the custom onError handler for httpProxyMiddleware only logs proxy error on the console (#502). This amends the onError handler so it will also send proper error response to the client.

Otherwise the client will wait for the response and eventually timeout with ERR_EMPTY_RESPONSE, instead of the proper proxy error. See two screenshots before/after this PR.

  1. No proper error response (timeout after up to 2 min):
    noerrorreponse

  2. Proper error response (with this PR):
    immediate500reponse

    Note the error response to the client also mirrors the error logged on the dev console:
    Proxy error: Could not proxy request /api/login from localhost:3000 to http://localhost:3001 (ECONNREFUSED).

@ghostghost added the CLA Signed label Sep 5, 2016
@gaearongaearon added this to the 0.4.2 milestone Sep 5, 2016
@gaearon
gaearon merged commit 29107ca into react:masterSep 5, 2016
@gaearon

Copy link
Copy Markdown
Contributor

Thanks!

@cloudmucloudmu changed the title Send proper error response in custom onError handler for httpProxyMiddleware.Send proper error reponse upon proxy errorSep 6, 2016
stayradiated pushed a commit to stayradiated/create-react-app that referenced this pull request Sep 7, 2016
…dleware. (react#588)
* Change http-proxy-middleware logLevel from silent to error
* provide onError handler for httpProxyMiddleware
* Send proper error reponse upon proxy error.
@cloudmucloudmu changed the title Send proper error reponse upon proxy errorSend proper error response upon proxy errorSep 11, 2016
@gaearongaearon mentioned this pull request Sep 18, 2016
@gaearon

Copy link
Copy Markdown
Contributor

This should be fixed in 0.4.2.
Please verify!

@cloudmu

Copy link
Copy Markdown
ContributorAuthor

Yes, works as expected.

feiqitian pushed a commit to feiqitian/create-react-app that referenced this pull request Oct 25, 2016
…dleware. (react#588)
* Change http-proxy-middleware logLevel from silent to error
* provide onError handler for httpProxyMiddleware
* Send proper error reponse upon proxy error.
@locklockBot locked and limited conversation to collaborators Jan 22, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@cloudmu@gaearon