-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Wrong protocol for socket url's in a local environment #1193
Comments
@micacardillo thanks for checking in and for the thorough explanation of what you're looking to have changed. at the moment the core maintainers aren't doing any work involving sockjs for one important reason - we've removed sockjs in favor of native |
I don't think this particular problem is is happening in the socket module. client/index.js seems fairly decoupled from socket implementation. Is there a branch with the sockjs --> WebSocket progress I can take a look at? |
Yes, the |
@micacardillo Did you find a workaround in the meantime? I have the exact same issue and am looking for a short-term solution that can be implemented either in nginx or webpack-dev-server configurations. Glad to hear this is getting patched out in future versions, looking forward to 3.0! |
I have the same problem |
@ProductivePerson @calepsol No solution yet. The browser sees the sockjs requests as a CORS violation if you change it to http. |
@ProductivePerson "when it's ready." generally speaking, asking about release dates is kind of taboo for most projects. we've got the milestone in the issues here so you can get a real-time view of what is left to do and what has already been done. coupled with the commit history on the branch, you can get a really good idea of where things are. not to pile on you, but this definitely isn't the right forum for that question. you always have the option to pop into the webpack gitter, or even ping one of the folks in the project on twitter. best to allow issues to stay focused on the original topic. |
@shellscape Noted and understand. Thanks for the cultural explanations as well. I'll remove the previous question to clear up the thread. |
@shellscape I'm confused by everything I've read regarding the move away from socks as I've been having a similar issue as the OP and have been debugging an issue in webpack-dev-server 3.1.0 and it always seems to want to connect to /socksjs-node/... Has version 3 really migrated away from socks? If so, why do I see what the op is seeing in 3.1.0? Is socks by default and I have to set a flag somewhere to enable websocket support? |
This comment has been minimized.
This comment has been minimized.
/cc @micacardillo Problem still exists? If somebody has problem please report here about this, any reproducible test repo welcome, thanks! |
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks! |
I have the problem! Do have a solution? |
Please don't write "I have a problem", please describe what problem you have (minimum reproducible test repo welcome) |
@evilebottnawi I'm sorry. But the issue initiator described my problem exactly. |
@dizel3d can you open new issue |
I can reproduce this as well. I am running vue app locally (http) with nginx proxy also locally (https). I just started debugging it but somehow socksjs is picking up the protocol from publicPath (but not host). I can modify host with socksHost property in dev server, but not protocol. Any progress on this??? Also, I am confused with not using socksjs by devServer. If it's using WebSocket could there be an option to disable sockjs? Seems like it's not needed anyway. Please, give some solution. |
Can you reopen this? I think the best solution would be to make protocol configurable in the same way as host, port and url are. Or is there a reason for this inconsistency? |
Code
Relevant webpack setting:
Expected Behavior
When running a webpack dev server on localhost in a development environment, I need the protocol for socket messages to be http, not https even if the
location.protocol
from the browser is https. In my usecase, an Nginx proxy resolves https requests for a particular host (https://my-domain.com) to the appropriate services (http://localhost:3000, http://localhost:3012, etc). I would then expect socket requests to behttp://localhost:3012/sockjs-node/info?t=1510792203948
nothttps://localhost:3012/sockjs-node/info?t=1510792203948
. Note the former ishttp
and the latter ishttps
. The expected behavior for the protocol is 'http' in my usecase.Actual Behavior
In webpack-dev-server, the browser's protocol, if available, takes precedence over the local protocol. This causes webpack features relying on sockets such as hot module reloading to fail in my environment.
For Bugs; How can we reproduce the behavior?
For Features; What is the motivation and/or use-case for the feature?
I would like to figure out some clean way of setting the protocol to http without necessarily breaking the "security by default" approach that is currently implemented. Is there a way I could solve this without having to shepard PR requests down the food chain (webpack-dev-server --> webpack --> nwb).
The relevant code is client/index.js, line 188 - 190:
If I submitted a pull request with something like:
is that probably going to break other people's setups? If so, do we take more of a configuration approach where I could set a string? Something like devServer.protocol = 'http' in webpack settings.
The text was updated successfully, but these errors were encountered: