Home > Net >  Can't connect to websocket after switching to secured protocol
Can't connect to websocket after switching to secured protocol

Time:12-11

I have built a web application with NodeJS/Express as the backend. The frontent connects using the websocket protocol. Everything works fine.

Now, I'm switching to the wss:// protocol, which, to my knowledge and according to enter image description here

I need to know what the problem here is / could be, or any pointers as to what to check to figure it out.

CodePudding user response:

The problem is related to the self-signed certificate, which browsers (at least Firefox, Chrome and Edge) silently disallow in this case.

I could circumvent this by visiting https://localhost:8999 directly, which displayed the well-known invalid certificate warning message. By clicking past that, the certificate is added as an exception (at least temporarily), and visiting my actual Angular application now also leads to a successful connection to the websocket.

Here is a description for how to add self-signed certificates permanently in Firefox. I expect other Browsers to work similarly.

  • Related