Skip to content

Proxy issue between two vue apps when created with vue-cli3 #3738

Open
@srchulo

Description

@srchulo

Version

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

  1. Go into public app and type "yarn serve".

  2. Go into app/ and type "yarn serve"

  3. Go to http://localhost:8080

  4. Open the developer console.

  5. Click "Go to App" link in the top right.

  6. Observe the console (web socket connection closes before it is established, and failed requests show).

  7. 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 vuejs/vue#9797 where I misfiled it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions