0

I am trying to open my react application to the internet. The application works perfectly fine on localhost. But will not work when using it on my Apache webserver. I'm running Ubuntu 16.04. I have the port that I am using forwarded and am using my address. This is the error from the browser console that I am receiving

on localhost, this address works perfectly fine however, when I change the address and port to use on my apache webserver, I get this error

using this address wss://www.example.io:4488/ I got this error :

WebSocket connection to 'wss://www.example.io:4488/' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR

After doing some research it appears that I need to use a port with SSL enabled, however is it possible to enable a port with SSL other than port 443?

I then tried using 'ws' and got this error,

ws://www.example.io:4488/

Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.

Berners55
  • 1
  • 1

1 Answers1

0

"is it possible to enable a port with SSL other than port 443?"

Yes, exactly like how you have done it (wss://www.example.io:4488) ... athough when using non standard ports, make sure there are not firewalls silently blocking connections (just use telnet to confirm, e.g. telnet www.example.io 4488)

"I then tried using 'ws' and got this error,"

Yes, expected. A website delivered over HTTPS cannot have insecure websockets.

A possible cause of your problem is the servers SSL certificate. When your browser attempts to open the websocket, it will receive the servers SSL certificate and attempt to validate. If it cannot validate, it will not allow the socket to open. It typically won't work with self signed certificates.

Related:

Firefox disconnects websockets connection for a self signed certificate

What is the problem with Websocket and Self-Signed SSL certificate

Why does my wss:// (WebSockets over SSL/TLS) connection immediately disconnect without giving any errors?

Darren Smith
  • 2,261
  • 16
  • 16