How can I fix these SockJS ssl errors? How can I fix these SockJS ssl errors? vue.js vue.js

How can I fix these SockJS ssl errors?


This was a struggle, but it's working now...

Add a public property to the devServer object in vue.config.

The property I needed was public, not publicPath, and the clincher was learning that vue will ignore config changes in configureWebpack{ devServer: {. You need to use the top level devServer property.

So my working vue.config.js is...

module.exports = {  baseUrl: process.env.NODE_ENV === 'production'    ? '/production-sub-path/'    : '\/mobileapp\/v\/',    devServer :{      public : 'notilusdev.dimosoftware.com',      host : '0.0.0.0',      disableHostCheck : true    }  }

Then I needed to reverse-proxy https and wss:// requests through express, terminating the ssl in express, but that's another story.


The web socket infers the schema from the URL that is configured.

You will need to expressly provide the key/cert/pem? to the devServer configuration in order to support this. Otherwise, it will attempt to use a self-signed certificate which, of course, won't work in your case.

devSever: {  ...,  key: fs.readFileSync('/path/to/server.key'),  cert: fs.readFileSync('/path/to/server.crt'),  ca: fs.readFileSync('/path/to/ca.pem'),}

This will use the correct SSL and solve your problem.

As a side note

You can't just decide to not use https for the websocket connection, either. However you can, instead, not use HTTPS at all and just use localhost:8081 as per usual if you don't want to go through this.