muaz-khan / WebRTC-Experiment

WebRTC, WebRTC and WebRTC. Everything here is all about WebRTC!!
https://www.webrtc-experiment.com/
MIT License
11.74k stars 3.95k forks source link

How to make record to node js server as https #592

Open ghost opened 6 years ago

ghost commented 6 years ago

I tried to make node js as https by adding certificates in record to node js but it is not working can you provide a solution for this

LaphazeMC commented 6 years ago

Add this to server.js var options = { key: fs.readFileSync('../../certs/server.key'), cert: fs.readFileSync('../../certs/server.crt'), requestCert: false, rejectUnauthorized: false };

Change var server = require('http') by require ('https') And finally, add options like this : var app = server.createServer(options, serverHandler);

That's all :)