[RFID] send info over https

[RFID] send info over https

  
Forge Component
(4)
Published on 2015-05-18 by Rui Barbosa
4 votes
Published on 2015-05-18 by Rui Barbosa
Do you know what would be involved in converting this to listen over https vs http?
Solution
Hi Jason,

On the nodeJS app original code this line 

var io = require('socket.io').listen(3001, {log: false});
 
creates a http server on port 3001 automaticaly.

If you want to use https you have to create an https nodeJS server first, which would look like this:
?
var fs = require('fs');

var options = {
  key: fs.readFileSync('/etc/ssl/certs/wildcard.my_example.com.no_pass.key'),
  cert: fs.readFileSync('/etc/ssl/certs/wildcard.my_example.com.crt')
};

var app = require('https').createServer(options, handler)
  , io = require('socket.io').listen(app);

app.listen(3001);

This is just an example taken from the web as I dont have a way to test it...

Cheers

Rui



Solution

hey guys,

Did you managed to make it work? I am getting error in browser console that:|
was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://localhost:3001/socket.io/?EIO=2&transport=polling&t=1474622556163-17'. This request has been blocked; the content must be served over HTTPS.


Justinas,

Hi Joc,

If you have set up your nodeJS with a certificate and started a https nodeJS server (as the example above) then you just need to change the url param of your RFID widget to point to https://your .server name:port/...


Cheers