My domain is: justlave.com
My web server is (include version): apache2@latest
The operating system my web server runs on is (include version): Ubuntu@latest
My hosting provider, if applicable, is: OVH
I can login to a root shell on my machine (yes or no, or I don't know): yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):no
The version of my client is (e.g. output of certbot --version
or certbot-auto --version
if you're using Certbot): 2.4.0
============================================================================
I am scratching my head because I do not understand how to fix this problem. This is only happening with this one server. All other nodejs + socket.io servers are running properly and have the same configuration. I'm running a website with apache2 and created a server with nodejs + socket.io. I've installed all the modules and when I run sudo pm2 start server
this is what I see respectively :
As you can see Node is listening and when I run this command sudo ss -ltnp
I see that the port is open.
I'm troubleshooting with the socket.io documentation here. I tried everything and I am lost. All my other servers with similar configuration all work. But this one is unreachable and I have no clue whats blocking the connection. When I paste this link in the browser https://server.justlave.com:3008/socket.io/?EIO=4&transport=polling
it takes forever to load.
Errors I get in the console (Network tab) :
the connection used to fetch this resource is not secure
I reinstalled and reconfigure my server for the third time in a row now. I've deployed over 100 servers in my engineer career and this has never happened to me. There is something wrong with the letsencrypt certificate but I don't know where to look to solve this. I am using certbot. Any insights regarding this issue would help. I'm on a tight deadline.
server.js
const express = require('express');
const app = express();
const https = require('https');
var options = {
key: fs.readFileSync('/etc/letsencrypt/live/server.justlave.com/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/server.justlave.com/cert.pem')
};
var server = https.createServer(options, app);
const io = require('socket.io')(server, {
cors: {
origin: '*',
methods: ["GET", "POST"],
allowedHeaders: ["my-custom-header"],
credentials: true
}
});
io.on('connection', (socket) => {
//GET SOCKET ID
var socketid = socket.id;//my socket id
//console socket connect
console.log('[justlave.com:3008][new user connected] : ' + socketid);
});
server.listen(3008, () => {
console.log('[justlave.com][Node listening on *:3008');
});
client.js
<script>
var socket = io.connect('https://server.justlave.com:3008', {'multiplex': false});
</script>
<html>
<body>
<!--do stuff here-->
</body>
</html>
<script src="https://server.justlave.com:3008/socket.io/socket.io.js"></script>