webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

Server Timeout

Open yjcxy12 opened this issue 10 years ago • 10 comments

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

yjcxy12 avatar Jan 29 '16 10:01 yjcxy12

a PR for ranges was merged

sokra avatar Mar 25 '16 09:03 sokra

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

revathskumar avatar Jun 27 '17 15:06 revathskumar

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

ShadowManu avatar Jul 29 '17 03:07 ShadowManu

@sokra Any reference to the PR?

pjivers avatar Oct 10 '17 04:10 pjivers

@yjcxy12, it worked perfectly, thanks!

node_modules\webpack-dev-server\lib\Server.js

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

mohankumarv2005 avatar Dec 06 '17 15:12 mohankumarv2005

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

asfernandes avatar Jan 30 '18 12:01 asfernandes

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.

catchin avatar Mar 28 '18 19:03 catchin

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

fuadmuhtaz avatar Apr 05 '18 04:04 fuadmuhtaz

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

prodrammer avatar Nov 05 '19 22:11 prodrammer

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 } },

abhishekkovuri avatar May 08 '20 19:05 abhishekkovuri