URL without Port Number

I was formerly using Apache to host a site on the same system that OpenVidu is running and all I had to do was update some configuration files to use port 5442 and I was able to access the site without the port number in the URL

Now, I am using Node.js and I have it configured to use the certification files from the directory /opt/openvidu/certificates, but I have only been able to access the site if the port number is 4443 and I have to use the port number in the URL. How can I configure Node.js so I can access the site without the port number in the URL as Apache?

Below is an example a server.js file I was able to get working on 4443

  1 const fs = require('fs');
  2 const https = require('https');
  3 
  4 const PORT = 4443;
  5 const CERT_PATH = "/opt/openvidu/certificates/";
  6 const certOptions = {
  7     key: fs.readFileSync(CERT_PATH + 'live/openvidu.example.com/privkey.pem'),
  8     cert: fs.readFileSync(CERT_PATH + 'live/openvidu.example.com/cert.pem'),
  9 };
 10 const httpsServer = https.createServer(certOptions, function(req, res){
 11     res.writeHead(200);
 12     res.end("hello");
 13 });
 14 httpsServer.listen(PORT);

You don’t have to configure any certificate in NodeJS.

You just have to publish Node.js web application in port 5442 so proxy installed with OpenVidu redirect all requests to https://openvidu.example.com/ to your application.

Take into account that proxy installed with OpenVidu will take care of certificate management.

More information: https://docs.openvidu.io/en/2.14.0/deployment/deploying-openvidu-apps/

Regards