I have a HTTP nodejs/socketio server running on port 3001 successfully. I'm trying to access the server from a SSL website encrypted with certbot (let's encrypt).
When I visit https//:example.com/index.html
, I see 404 error :
GET https://www.example.com:8000/socket.io/socket.io.jsnet::ERR_ABORTED 404 (Not Found)
I've been reading about configuring apache with mod_proxy here and here. HOWEVER, according to nodejs documentation, all is needed is pem files which I have.
I feel like I'm chasing my own tail and I need help. I've been spending nearly a week doing research and trying different approaches. I'm back at square one. Anyone ran a https server and accessed it over SSL website successfully? Here all the relevant codes below.
server.js
const express = require('express');const app = express();const https = require('https');const fs = require('fs');// This line is from the Node.js HTTPS documentation.var options = { key: fs.readFileSync('../ssl/privkey.pem'),//etc/letsencrypt/ cert: fs.readFileSync('../ssl/cert.pem') };const sslserver = https.createServer(options,app);//establish connectionio.on('connection', (socket) => {//requests});//listening for httpssslserver.listen(8000, () => {console.log('listening on *: 8000');});
index.html
<!DOCTYPE html><html><head><title>My Web App </title><meta charset="utf-8"><meta name="format-detection" content="telephone=no"><meta name="msapplication-tap-highlight" content="no"><meta name="viewport" content="initial-scale=1, width=device-width, viewport-fit=cover"><meta name="color-scheme" content="light dark"></head><body ><p>Welcome to web app</p><p>login now</p></body></html><!--SCRIPTS--><script src="cordova.js"></script><script src="https://www.example.com:8000/socket.io/socket.io.js"></script><script type="text/javascript">var socket = io.connect('https://www.example.com:8000', {'multiplex': false});</script>