Secure Websocket Server in Glitch Project?


#1

I’m trying to set up a express-fronted project that will require both a websocket server (just using the node ws module) and ssl (because we’re using secure-context-only Web APIs). That means that we need our websocket server hosted as SSL so we don’t get mixed content errors.

My understanding is that the *.glitch.me domain will proxy 80/443 to the express server on port 3000, but what method should I use for hosting the ssl cert on the express server so I don’t get security problems on the websocket forwarding? Will the proxy automatically accept self-signed certificates?


#2

You can add a websocket handler, enabling it to run on the same port as your HTTP(S) requests - see https://www.npmjs.com/package/express-ws


#3

I already had a websocket handler, running ws and express. The problem was that I was trying to access the websocket securely (wss://) but it wasn’t working.

I revisited the problem this morning, setting up the server as unsecure (ws://) then running the client through the front end (wss://my-project.glitch.me) and that actually seemed to work fine when accessing the project over https, so I’m back in business. Thanks!


#4

Pleased to hear it. Out of interest, which handler were you using? Thanks.