Derek-R-S/Light-Reflective-Mirror

WebGL build crashes when accessing LRM server

Closed this issue · 4 comments

My WebGL game crashes when making a request to https://relay.example.com:8080/api/compressed/servers (where relay.example.com resolves to a digital ocean vps).

Visiting the url through firefox shows the following:

Secure Connection Failed

An error occurred during a connection to relay.example.com:8080. SSL received a record that exceeded the maximum permissible length.

Error code: SSL_ERROR_RX_RECORD_TOO_LONG

- The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
- Please contact the website owners to inform them of this problem.

If I visit the url with http instead of https, everything seems to be fine.

Are there settings in LRM/Mirror that I'm missing that can help with this?

Here is my LRM configuration:

{
  "TransportDLL": "MultiCompiled.dll",
  "TransportClass": "Mirror.SimpleWebTransport",
  "AuthenticationKey": "password",
  "TransportPort": 7777,
  "UpdateLoopTime": 10,
  "UpdateHeartbeatInterval": 100,
  "UseEndpoint": true,
  "EndpointPort": 8080,
  "EndpointServerList": true,
  "EnableNATPunchtroughServer": true,
  "NATPunchtroughPort": 7776,
  "UseLoadBalancer": false,
  "LoadBalancerAuthKey": "AuthKey",
  "LoadBalancerAddress": "127.0.0.1",
  "LoadBalancerPort": 7070,
  "LoadBalancerRegion": 1
}

Here is my SWT configuration:

{
  "maxMessageSize": 16384,
  "handshakeMaxSize": 3000,
  "noDelay": true,
  "sendTimeout": 5000,
  "receiveTimeout": 20000,
  "serverMaxMessagesPerTick": 10000,
  "waitBeforeSend": false,
  "clientUseWss": true,
  "sslEnabled": true,
  "sslCertJson": "./cert.json",
  "sslProtocols": 3072
}

I seem to have fixed the problem by changing the LRM endpoint port to 443. Then I set up a reverse proxy from 8080 to 443.

If anyone is interested, here's a working Caddyfile. Obviously you would replace relay.example.com.

relay.example.com:8080

reverse_proxy {
        to relay.example.com:443
}

Remember to change the EndpointPort to 443 in the LRM config.json.