0

I have a two webservers both running https with the same certificates, I have a main shard that the user connects to example.com, they retrieve some data and try to connect to an ip address on the 2nd shard via websocket.

But no matter what I configure I get an Error 1006 on the client side when connecting to the 2nd shard. Firefox devtooling gives me multiple errors - ssl_error_bad_cert_domain, SSL_ERROR_RX_RECORD_TOO_LONG.

The certificates are issued and signed, I was wondering where I should go from here. Thanks :)

SHARD2

const options = {
    key: './server.key',
    cert: './server.cert'
};

var https = require('https').Server(options);

https.listen(443, function () {
    // console.log('Https listening on *: 443');
});

let WebSocket = require('ws');

let socket = new WebSocket.Server({ server:https });

socket.on('connection', function (ws, req) {

    ws.on('message', (msgRaw) =>{

    });

    ws.on('close', function(code, reason) {

    });

    ws.on('error', function(error) {
        console.log(error);
        ws.close();
    });
});

CLIENT

function connect() {
    "use strict";

    window.WebSocket = window.WebSocket || window.MozWebSocket;

    if (!window.WebSocket) {
        alert('Your browser doesn\'t support WebSocket');
        return;
    }

    wss = new WebSocket('wss://123.123.123.120/:443');

    wss.onmessage = function(event) {

    };

    wss.onerror = function(event) {
        console.log(`wss error: ${JSON.stringify(event)}`);
    };

    wss.onclose = function(event) {

    };
}

Useful sys diagram?

fmac
  • 1
  • 2

0 Answers0