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

Client-canceled XMLHttpRequests to proxy API cause webpack dev server to reload #427

Closed
anthonybarsotti opened this issue Mar 15, 2016 · 10 comments

Comments

@anthonybarsotti
Copy link

I've run into an issue where if an XMLHttpRequest to a proxy API is either aborted or times out on the client it causes a proxy error and the dev server reloads the page. Does anyone know of a way around this?

@anthonybarsotti anthonybarsotti changed the title Client-canceled XMLHttpRequests cause webpack dev server to reload Client-canceled XMLHttpRequests to proxy API cause webpack dev server to reload Mar 15, 2016
@anthonybarsotti
Copy link
Author

I've gotten around this temporarily by imposing the timeout on the server but I'm still curious to see if there is a solution to this.

@vanwagonet
Copy link

It looks like aborting a proxied request triggers a "proxy error" message through the socket, which causes the client to reload.

@jiarongxu
Copy link

Same issue here. Any solution?

@oers
Copy link

oers commented Jul 20, 2016

same issue like this?:

#369

I think we need a way to configure/disable the timeout for long running requests.

@makuko
Copy link

makuko commented Aug 3, 2016

This can be fixed by adding the following line between lines 147 and 148 of lib/Server.js in 1.14.1:

if (err.code === 'ECONNRESET') return;

ECONNRESET means it was not actually an error but intentional by the client.

@doxavore
Copy link

I can confirm @makuko's fix works in 1.14.1. This can sometimes be very common issue for those of us using Angular 2 + RxJS.

@SpaceK33z
Copy link
Member

This was fixed with PR #478, and released with 1.15.0.

@hantsy
Copy link

hantsy commented Mar 31, 2017

I always encountered the ECONNRESET when used a proxy config in my Angular2 project(generated by Angular CLI 1.0.0 which shipped webpack-dev-server 2.3.0).

[HPM] GET /api/upload/uploads-1490782788752.png -> http://localhost:3000
[HPM] Error occurred while trying to proxy request /api/upload/uploads-1490782788752.png from localhost:4300 to http://localhost:3000 (ECONNRESET) (https://nodejs.org/api/errors.html#errors_common_system_errors)

@dhatawesomedude
Copy link

@hantsy how did you get around this for Angular 2 projects?

@hantsy
Copy link

hantsy commented Aug 23, 2017

@dhatawesomedude It seems it is disappeared in the latest Angular 4+, I was using newest Angular CLI to create the projects.

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

No branches or pull requests

10 participants