webpack-dev-server: No data received ERR_EMPTY_RESPONSE

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 6
  • Comments: 27 (2 by maintainers)

Commits related to this issue

Most upvoted comments

This might help some of you. I was experiencing the same issue running a vagrant VM with port forwarding on port 3000. I could curl http://localhost:3000 from within the VM but content wasn’t getting forwarded. By default, webpack-dev-server binds to localhost (127.0.0.1) which is a loopback address. Therefore you need to add --host 0.0.0.0 to your webpack-dev-server command. Mine:

webpack-dev-server --hot --progress --colors --host 0.0.0.0 --port 3000

No other changes were necessary.

@fredantell provides a similar solution above.

To follow up, I’m not sure that we really solved the problem, but we did work around it. On the machine that was having issues, accessing the server from http://127.0.0.1:8080/ worked where http://localhost:8080/ failed. This is despite the /etc/hosts file appearing to be correct, and despite the fact that a python SimpleHTTPServer was accessible via http://localhost:8080/ with no issues.

In addition to that workaround, we also dropped our repo into a docker container. In order to make that function properly we added a “-host 0.0.0.0” flag to the command to launch the server. In the end it became: “webpack-dev-server --hot --host 0.0.0.0 --progress --colors” and our webpack.config.js had this entry: entry: { app: [ “webpack-dev-server/client?:8080/”, //fix issues with socket.io and live reloading ‘webpack/hot/dev-server’, … ] }

or shadow sock something

guess you should check if there’s some proxy extension on your chrome XD

I had this problem; turns out I had an errant Docker container running in the background from another project listening on the same port (no http errors shown in webpack-dev-server though - watch out!). Stopped the containers, then everything worked @ localhost:8080

I was able to delete ‘::1 localhost’ in /etc/hosts and it works now

problem: localhost:8080 failed but 127.0.0.1:8080 worked i resolved this problem by delete the line ‘::1 localhost’ in the /etc/hosts

I was able to solve this issue by doing this as well:

webpack-dev-server --port 3000

I had to use 127.0.0.1

Try using 127.0.0.1 or another alias from /etc/hosts. You’ll need to use a matching --host parameter when you start webpack-dev-server and may need to update output.publicPath in your config as well.

Here’s how I did it.

in /etc/hosts: 127.0.0.1 cheetah

in webpack.config.js: output.publicPath = 'http://cheetah:8080/';

command line: webpack-dev-server --host cheetah

** PS ** this was simplified from my actual configuration.

Maybe you could try it that turn “Global Mode” to “Auto Proxy Mode” in ShadowsocksX.