Coder Social home page Coder Social logo

HTTPS SSL gotcha about peerjs-server HOT 16 CLOSED

redannick avatar redannick commented on April 28, 2024
HTTPS SSL gotcha

from peerjs-server.

Comments (16)

SameerRathod avatar SameerRathod commented on April 28, 2024 1

I am also getting error but it is slightly different
It is saying me

Could not get an ID from the server. If you passed in a path to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer.

here is my configuration
var peer = new Peer(id,{host: '111.118.237.23', port: 9009,secure:true});

I am using a custom node server

var fs =require('fs');

var PeerServer = require('peer').PeerServer;
var server = new PeerServer({host:'111.118.237.23',port: 9009,
ssl: {
key: fs.readFileSync('/etc/ssl/certs/server.key'),
certificate: fs.readFileSync('/etc/ssl/certs/server.crt')
}

});

and self signed certificate
please help me in my scenario I cant use this product unsecured without ssl

from peerjs-server.

michelle avatar michelle commented on April 28, 2024

Are you getting something like Error: DEPTH_ZERO_SELF_SIGNED_CERT? How is it failing?

from peerjs-server.

inian avatar inian commented on April 28, 2024

I solved this problem by opening the URL which the app makes a request to in a new tab, then confirm the security exception thrown by Chrome (since the certificate is self-signed, Chrome wont recognise it).
After adding the exception, the app worked fine.

from peerjs-server.

redannick avatar redannick commented on April 28, 2024

@michelle I was not getting any errors from the server, and chrome wasn't giving me any errors either. I did try what @inian suggests too, but couldn't get the browser to detect the certificate as it wasn't an http request

from peerjs-server.

inian avatar inian commented on April 28, 2024

Yes, try enabling XMLHTTPRequests in the Chrome dev tools console and then you would be able to see the requests being made.

from peerjs-server.

luongnv89 avatar luongnv89 commented on April 28, 2024

@sameer293 Did you manage this problem?

from peerjs-server.

SameerRathod avatar SameerRathod commented on April 28, 2024

@luongnv89 not yet.

from peerjs-server.

clarencechen avatar clarencechen commented on April 28, 2024

@redannick @michelle @sameer293 @luongnv89 This problem is still happening in 2017 :(

from peerjs-server.

luongnv89 avatar luongnv89 commented on April 28, 2024

@clarencechen I follow the tutorial in this: https://www.npmjs.com/package/peer, and it works for me.

This is how I did it:

var app = express()
var ExpressPeerServer = require('peer').ExpressPeerServer
var peerjs_options = {
    debug: true
}
var ssl_options ={
    key:fs.readFileSync('./certificate/myserver.key'),
    ca:fs.readFileSync('./certificate/GandiStandardSSLCA2.pem'),
    cert:fs.readFileSync('./certificate/certificate.crt'),
    honorCipherOrder: true,
    ciphers: 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:HIGH:!RC4:!MD5:!aNULL:!EDH'
}
var server = https.createServer(ssl_options,app)
var peerServer = ExpressPeerServer(server, peerjs_options)

... set your app ... 

app.use('/myapp', peerServer)
server.listen(443)

Hope this help

from peerjs-server.

clarencechen avatar clarencechen commented on April 28, 2024

Are there any files or strings I should obtain?
Thanks so much in advance

from peerjs-server.

sreekj avatar sreekj commented on April 28, 2024

@SameerRathod
Sameer, were you able to get over this issue ?

from peerjs-server.

afrokick avatar afrokick commented on April 28, 2024

Use lets encrypt to obtain cert and key, then use it for reverse proxy or pass in options

node ./src/index.js --sslCertPath /path/to/cert.pem --sslKeyPath /path/to/key.key

from peerjs-server.

redannick avatar redannick commented on April 28, 2024

@afrokick does this help with local https development?

from peerjs-server.

afrokick avatar afrokick commented on April 28, 2024

@afrokick does this help with local https development?

Sorry, i don't know. I test it on local http and it works perfectly.

from peerjs-server.

redannick avatar redannick commented on April 28, 2024

I only mention it as I believe this was what I was doing in the first place. I was testing something that required https so expected a self cert to work. I suppose you could spoof a domain in your hosts file perhaps to use a let's encrypt certificate locally or put it on a temporary domain and this was my original workaround, but really, shouldn't a self cert work in the first place?

from peerjs-server.

AlexErrant avatar AlexErrant commented on April 28, 2024

I suppose you could spoof a domain in your hosts file... shouldn't a self cert work in the first place?

I do this in my project, and document how to "get started" here. The steps aren't specific to PeerJS, but you should be able to understand how mkcert works and generate your own selfsigned key/cert and update your hosts file for peerjs-server from that doc.

from peerjs-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.