How to use https with letsencrypt, socket.io and node.js?
<p>Im trying to get https to work with socket.io and node.js.
I can connect and all works if I test with a http page.</p>

<p>I get this error when I try to load the socket.io.js file.</p>

<pre><code>GET https://my ip number:3000/socket.io/socket.io.js net::ERR_INSECURE_RESPONSE
</code></pre>

<p>Im linking like this</p>

<pre><code> &lt;script src="https://my ip number:3000/socket.io/socket.io.js"&gt;&lt;/script&gt;
</code></pre>

<p>And my server.js file looks like this</p>

<pre><code>    var fs = require('fs');
    var https = require('https');
    var http = require('https');
    var express = require('express');
    var app = express();

    var options = {  
        key: fs.readFileSync('C:/Users/kund-admin/AppData/Roaming/letsencrypt-win-simple/httpsacme-v01.api.letsencrypt.org/manmade.se-key.pem'),
        cert: fs.readFileSync('C:/Users/kund-admin/AppData/Roaming/letsencrypt-win-simple/httpsacme-v01.api.letsencrypt.org/manmade.se-chain.pem')
    };

    var serverPort = 3000;
    var server = https.createServer(options, app);
    var io = require('socket.io').listen(server);
    var port = process.env.PORT || 3000;
    server.listen(port);
    console.log('Server running *:'+port);

//routing
app.get('/', function(req, res) {
    res.sendFile(__dirname + '/messages.asp');
});
</code></pre>

<p>And if I run server.js in the node terminal I get "Server running:3000" but when I try to load my index page I get the error?
I have no idea what Im doing wrong at this stage, I have tested so many things I can't remember what I have tried or not!</p>

<p>So any input really appreciated, thanks!</p>

<p>SOLVED!!
So it turned out that you can't have the IP number in the link to the socket.io.js file!!!
It has to be the domain.
So it has to be
 <code>&lt;script src="https://somedomain.com:3000/socket.io/socket.io.js"&gt;</code></p>