Webpack-dev-server: Server Timeout

Created on 29 Jan 2016  路  10Comments  路  Source: webpack/webpack-dev-server

I was working with video and serve the file from local file system. If the video length is more than 2 minutes, the server gives net::ERR_CONTENT_LENGTH_MISMATCH error.

It was due to express server default timeout is 2 minutes. My temporary solution was to change manually to Server.js -> listeningApp to set timeout to 0.

Is there a better way to solve the problem? If not, is there going to be a configurable option for server timeout in the future?

Thanks

Most helpful comment

I also had the problem of 2 minutes timeout for a proxy request and I could solve the problem with the following webpack-dev-server configuration for http-proxy:

proxy: {
  '/api': {
    target: 'http://localhost:8080',
    proxyTimeout: 5 * 60 * 1000,
    onProxyReq: (proxyReq, req, res) => req.setTimeout(5 * 60 * 1000)
  }
}

See webpack-dev-server, http-proxy and node http api documentations.

All 10 comments

a PR for ranges was merged

@sokra Is this settings available on webpack 1.x?

@sokra any reference to the PR? angular/angular-cli seems to have an error about this and I'm searching for information about it.

@sokra Any reference to the PR?

@yjcxy12, it worked perfectly, thanks!

node_moduleswebpack-dev-server\lib\Server.js

this.listeningApp.timeout = 600000; //10 Minutes

I'm still having a timeout with a reconnect after 2 minutes with webpack-dev-server 2.11.1.

I also had the problem of 2 minutes timeout for a proxy request and I could solve the problem with the following webpack-dev-server configuration for http-proxy:

proxy: {
  '/api': {
    target: 'http://localhost:8080',
    proxyTimeout: 5 * 60 * 1000,
    onProxyReq: (proxyReq, req, res) => req.setTimeout(5 * 60 * 1000)
  }
}

See webpack-dev-server, http-proxy and node http api documentations.

If you want no timeout you can set 0 to proxyTimeout and onProxyReq.

I've tried all of these suggestions, no dice. The browser disconnects after 2 minutes. Any other suggestions?

As I use axios for making api calls. so eventually i was trying to set timeout there.
I was also in a assumption that setting a time out there would work but it was not working tried number of ways.
Finally i have created a html and tried axios there then i realised that i need to make changes in my webpack.
adding proxyTimeout would solve the issue
proxy: {
'/api/**': {
target: 'http//localhost:8888/',
proxyTimeout: 10 * 60 * 1000,
onProxyReq: (proxyReq, req, res) => req.setTimeout(10 * 60 * 1000),
changeOrigin: true
}
},

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ky6uk picture Ky6uk  路  3Comments

eyakcn picture eyakcn  路  3Comments

wojtekmaj picture wojtekmaj  路  3Comments

antoinerousseau picture antoinerousseau  路  3Comments

mrdulin picture mrdulin  路  3Comments