Cannot create PeerJS Server on Port 443

Viewed 160

My server has an SSL certificate, and the domain works fine with https. I ran "npm install peer", and then ran this javascript:

const { PeerServer } = require('peer');
const peerServer = PeerServer({
    port: 9000,
    path: '/myapp'
});

It worked, but only under http, and if secure:false. This URL returned the correct JSON: http://www.example.com:9000/myapp

I then removed the 'port9000' PeerJS Server, and ran this javascript, so it would hopefully work with secure:true:

const { PeerServer } = require('peer');
const peerServer = PeerServer({
    port: 443,
    ssl: {
        key: fs.readFileSync('my.key'),
        cert: fs.readFileSync('my.crt')
    },
    path: '/myapp2'
});

This did not work. The following URL returned a blank directory, and no JSON: https://www.example.com:443/myapp2

My server is running CentOS v. 7.8 64 bit, and it uses httpd.

Let me know if it will be easier to configure a port that is not "well-known" (i.e. not 443) to use for https communication with the PeerJS Server, so I can set "secure: true" in the client script.

0 Answers
Related