Webpack-dev-server: Client-canceled XMLHttpRequests to proxy API cause webpack dev server to reload

Created on 15 Mar 2016  路  10Comments  路  Source: webpack/webpack-dev-server

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?

bug

All 10 comments

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.

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

Same issue here. Any solution?

same issue like this?:

https://github.com/webpack/webpack-dev-server/issues/369

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

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.

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.

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

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)

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gimmi picture gimmi  路  3Comments

hnqlvs picture hnqlvs  路  3Comments

piotrszaredko picture piotrszaredko  路  3Comments

mischkl picture mischkl  路  3Comments

StephanBijzitter picture StephanBijzitter  路  3Comments