Proxy issue between two vue apps when created with vue-cli3
See original GitHub issueVersion
3.5.3
Reproduction link
https://github.com/srchulo/vue-cli3-proxy-error
Environment info
System:
OS: Linux 3.10 CentOS Linux 7 (Core)
CPU: (1) x64 Intel(R) Xeon(R) Gold 6140 CPU @ 2.30GHz
Binaries:
Node: 11.13.0 - /usr/bin/node
Yarn: 1.9.4 - /usr/bin/yarn
npm: 6.9.0 - /usr/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmGlobalPackages:
@vue/cli: 3.0.1
Steps to reproduce
-
Go into public app and type “yarn serve”.
-
Go into app/ and type “yarn serve”
-
Go to http://localhost:8080
-
Open the developer console.
-
Click “Go to App” link in the top right.
-
Observe the console (web socket connection closes before it is established, and failed requests show).
-
Make a change to app/, observe that hot reload will not occur.
What is expected?
Websockets should successfully be proxied to the Vue app on port 8081 and hot reload for the app on 8081 should work.
What is actually happening?
The websockets never connect, there are many failed requests, and hot reload does not work.
I did not have this issue when my project was on vue-cli2-- it was once I upgraded to vue-cli3 that I saw this issue.
These are some of the errors that I observe:
WebSocket connection to 'ws://localhost:8080/app/sockjs-node/946/btaua0jf/websocket' failed: WebSocket is closed before the connection is established.
POST http://localhost:8080/app/sockjs-node/946/2f03xsro/xhr_streaming?t=1554071918837 404 (Not Found)
GET http://localhost:8080/app/sockjs-node/946/a5xm1iat/eventsource 404 (Not Found)
GET http://localhost:8080/app/sockjs-node/139/crmbubvo/eventsource 404 (Not Found)
Additional error that shows from jsonp?c=_jp.aemoxtb:1
:
Uncaught SyntaxError: Unexpected token <
After leaving both servers open long enough and having the page opened to /app, then this error will show in the terminal for the public app:
Proxy error: Could not proxy request /app/sockjs-node/266/vz0ie5cy/websocket from localhost:8080 to http://localhost:8081. See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ECONNRESET).
And it will continue to give that error with slightly different arguments after sockjs-node/
.
refiling from https://github.com/vuejs/vue/issues/9797 where I misfiled it.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top GitHub Comments
Haven’t run the reproduction yet, so this is just from looking at the config:
You haven’t told the proxy to handle websocket connections as well:
Can it be related to this - https://github.com/nodejs/node/issues/23169 ?