-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Websocket connection ignores the publicPath parameter #1809
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
Comments
Can you create minimum reproducible test repo, i think it is problem in configuration |
Also |
I think you can setup proxy for handle statics for python server |
Hey, thanks for tips 😄 . I managed to make a minimum reproducible repo: It's available on gitpod: If you open the browser for the service running on 9000 (django), you should see the infinite loop. If you open it on 8080, there the hot reload works correctly. I had to change the config a bit because accessing ports on gitpod is with |
It is not clear which 'publicPath' parameter you are referring to in your reply, as the parameter applies to both output and devServer. In either case, the webpack and webpack-dev-server documentation both allow absolute or relative paths. In fact, the webpack-dev-server documentation specifies a full URL will be used to server content. In regards to the original problem of the websocket connecting to the wrong location, I faced the same problem after trying an update from version 3.2.6 to 3.3.1. I load the assets served by webpack-dev-server on a different host:port from my web application. Before the update, the development assets loaded from the development servers host:port. Following the change, all websocket requests switched to originate from the host:port of the web application. I was able to resolve the issue by adding the devServer.public parameter to 'host:port' matching the development server. Here is an excerpt from my working configuration, where I run the application on https://subdomain.localhost.
|
I confirm that adding the I fixed the reproducing repo with this commit: |
Now we support |
Code
Summary
Hello,
I have django project that uses javascript assets from a webpack-dev-server instance.
The django app runs on
localhost:9000
and webpack-dev-sever runs onlocalhost:8080
.In development, the django template loads static assets from
localhost:8080
.The problem is that the hot reload code tries to connect to
ws://localhost:9000
instead of8080
, and since the request is rejected by the django server, it gets stuck in an infinite loop.Failed connection

Infinite loop

Expected Behavior
I think when setting the
devServer:publicPath
tohttp://localhost:8080
it should also do the websocket connection to that port.Actual Behavior
The hot reload code tries to connect to
ws://localhost:9000
instead of8080
For Bugs; How can we reproduce the behavior?
I tried setting the
sockPath
parameter, but that only appends tows://localhost:9000
.In a project with older dependencies, it works as expected, and connects to
ws://localhost:8080
.These are the dependencies where it works.
I think in webpack-dev-server version
3.1.14
thesockPath
parameter was not yet available.Doing it in reverse works. By connecting to
localhost:8080
it proxies the requests to django onlocalhost:9000
.The problem in doing this is that my docker setup is broken. If run webpack-dev-server and django in separate containers, webpack-dev-server doesn't know where to proxy.
The text was updated successfully, but these errors were encountered: