Vue-cli: Websocket connection failed, Invalid frame header

Created on 14 Jul 2018  路  12Comments  路  Source: vuejs/vue-cli

Version

3.0.0-rc.3

Reproduction link

http://localhost:8080

Steps to reproduce

npm run serve

What is expected?

no error

What is actually happening?

when i run dev serve, brower console print socket error.
image
image

needs reproduction

Most helpful comment

In my case, I use the following configuration to proxy websocket for my site:

proxys: {
  '/websocket': {
    target: my_ws_server,
    ws: true,
    changeOrigin: true
  }
}

It will cause the same problem like the issue said.

All what I do to resolve is to add a '^' :

proxys: {
  '^/websocket': {
    target: my_ws_server,
    ws: true,
    changeOrigin: true
  }
}

All 12 comments

You seem to be messing with the proxy with this proxyfile? But you don't share it.

We can't investigate you report without a proper, run able reproduction (as a guy repository)

Please provide one or we have to close this issue.

image

proxyFile content.

That's not a run able reproduction. I won't type the code from your screenshot to run it.

I am running into this issue too. Basically, when the / path exist, HMR websocket requests are not ignored and will be somehow proxied. This can be disabled by adding ws: false to the options, however, this will disable all websocket requests.

I am running into this issue too

+1

proxytable key 'ws' set false, this will disable all websocket requests.

In my case, I use the following configuration to proxy websocket for my site:

proxys: {
  '/websocket': {
    target: my_ws_server,
    ws: true,
    changeOrigin: true
  }
}

It will cause the same problem like the issue said.

All what I do to resolve is to add a '^' :

proxys: {
  '^/websocket': {
    target: my_ws_server,
    ws: true,
    changeOrigin: true
  }
}

@ChrisShen93 Cool, in which package does the ^ actually took effect?

@rayax86
Sorry for late reply.
That's for the http-proxy-middleware.

ws鏀逛负false

Why set it to ws: false, it works?

Was this page helpful?
0 / 5 - 0 ratings