KielerGames/ringofsnakes

Enable HTTPS/secure WebSocket connections

Closed this issue · 4 comments

  • Find out what it takes to enable secure connections on the server (the client changes for this are trivial)
  • Is there a noticeable performance hit when using wss:// instead of ws:// ?
  • remove client error dialog & check (currently shows message asking the user to switch to HTTP)

We will need a certificate for the Websocket server, so it's probably a good idea to use a domain instead of the raw IP (like we do at the moment). I created ws.ringofsnakes.io for this.

Test URL: https://ringofsnakes.io/?useSSL

The connection does not work unfortunately though I do not know why. In Azure I added a rule to allow inbound TCP connections on port 443 (Settings > Networking > Inbound port rules) and on the server I forwarded those to port 8443 (sudo iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-ports 8443). I also imported the certificate I got from ionos with keytool: keytool -importcert -file ssl_cert.cert.

Connecting manually to https://ws.ringofsnakes.io/game I get an SSL_ERROR_HANDSHAKE_FAILURE_ALERT error.

Finally got this working thanks to: https://stackoverflow.com/a/65459423/3315770