0

enter image description hereI recently upgraded my VUE CLI to 3.5.5

After running the standard install, I noticed CORS and websocket errors being thrown in the browser ...Connection closed before receiving a handshake response. The errors are thrown in both Firefox and Chrome.

I am guessing this has something to do with the webpack devserver and CORS but its a guess because I know nearly nothing about webpack.

I added a vue.config.js and tried various configs for the webpack devServer but none have worked.

Can anyone illuminate this issue? - it must be very common. Thanks

Greg
  • 2,654
  • 3
  • 36
  • 59
  • can you paste the error stack trace? – Nathan Apr 09 '19 at 15:11
  • new to Vue so Ive no idea where to collect stack traces. All I can see is console errors – Greg Apr 09 '19 at 15:15
  • As far I know cors request did not success means something network problem may be. If it really something to do with cors browser will suggest to add some headers. https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSDidNotSucceed – Pallamolla Sai Apr 09 '19 at 16:00
  • can you check this link once. https://stackoverflow.com/questions/51831652/cors-request-did-not-succeed-on-firefox-but-works-on-chrome – Pallamolla Sai Apr 09 '19 at 16:04

1 Answers1

0

So the solution i found was to create a vue.config.js file at the root level of the project and use this webpack config:

module.exports = {
 devServer: {
 host: "0.0.0.0",
 public: "0.0.0.0:8080",
 disableHostCheck: true,
 proxy: {
   "/app": {
     target: "http://localhost:8081",
     changeOrigin: true,
     ws: true
     }
   }
 }
};
Greg
  • 2,654
  • 3
  • 36
  • 59