peers / peerjs

Simple peer-to-peer with WebRTC.
https://peerjs.com
MIT License
12.48k stars 1.43k forks source link

ERR_SSL_PROTOCOL_ERROR #449

Closed nitcheulegrand closed 6 years ago

nitcheulegrand commented 6 years ago

Hello I am using PeerJS to implement a video conference web app. I got this error while creating an instance of Peer object withought giving a key: GET https://0.peerjs.com:9000/peerjs/id?ts=15377843943420.9081415662556815 net::ERR_SSL_PROTOCOL_ERROR

kidandcat commented 6 years ago

Do you want to use SSL or not? if you dont use SSL, don't pass httpS.

If you want to use SSL, you will need to change the port (next week we will publish a new version with a fix).

So in the configuration options, pass:

{
  port: 443,
  host: "https://0.peerjs.com"
}
nitcheulegrand commented 6 years ago

image Screenshot of Chrome browser

nitcheulegrand commented 6 years ago

let p = new Peer({ key: 'lwjd5qra8257b9', secure: true, initiator: true, stream: stream });

nitcheulegrand commented 6 years ago

Let me do it as you say an come back to you. Thank for assistancy.

nitcheulegrand commented 6 years ago

The problem persist let p = new Peer({ key: 'lwjd5qra8257b9', port: 443, host: "https://0.peerjs.com", secure: true, initiator: true, stream: stream }); @kidandcat You can check it yourself on this adresse https://legrandsoft.alwaysdata.net/

kidandcat commented 6 years ago

Sorry: host: "0.peerjs.com"

PD: remove https://

kidandcat commented 6 years ago

is it resolved?

sonoiodc commented 4 years ago

is it resolved?

Hi, I'm having the same problem, was it fixed? I'm trying an unsecure connection without SSL; I even set the secure to false

denis-trofimov commented 4 years ago

I have it too!

what I have my_unsecure_peerjs_server:9000/peerjs/peerjs/id?ts=15881706796810.5981145912052981:1 Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR peerjs.min.js:119 ERROR PeerJS: Error retrieving ID (TypeError) Failed to fetch

In JS I have no SSL references, but my domain sits on valid https URL.

var peer = new Peer({
  host: "my_unsecure_peerjs_server",
  port: 9000
})

Expected

my_unsecure_peerjs_server:9000/peerjs/peerjs/id in my Chrome browser gives me UUID seamlessly.

UPD solved

var peer = new Peer({
  host: "my_unsecure_peerjs_server",
  secure: false,
  port: 9000
})

now I need to solve Mixed Content: The page at 'https://my_secure_website/' was loaded over HTTPS, but requested an insecure resource 'http://my_unsecure_peerjs_server:9000/peerjs/peerjs/id?ts=15881726442920.8792690531482552'. This request has been blocked; the content must be served over HTTPS.

UPD 2 Really solved by now! I was wrong yesterday. Now the Mixed Content issue is solved, it require secure: true and both my web site and peerjs-server should be loaded over a secure HTTPS connection

var peer = new Peer({
  host: "my_peerjs_server_with_ssl_cert",
  secure: true,
  path: '/peerjs'
});
javac0d3 commented 4 years ago

I do have a similar issue with Mixed content after setting the secure to false, the Id does not get delivered to client. Will keep posted if i find a solution, anybody else who did fix this can be of quick support to us.

denis-trofimov commented 4 years ago

I do have a similar issue with Mixed content after setting the secure to false, the Id does not get delivered to client. Will keep posted if i find a solution, anybody else who did fix this can be of quick support to us.

I think it is OK to receive Mixed content error in my case, that is how SSL should work.

https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content TL;DR Browsers may block mixed content altogether over time, in order to protect your site's users.

The only way I managed to solve it - put my peerjs-server behind reverse-proxy Nginx with SSL cert and solve trouble with headers (this Nginx proxy I don't control, my admin pal did it for me).

denis-trofimov commented 4 years ago

I do have a similar issue with Mixed content after setting the secure to false, the Id does not get delivered to client. Will keep posted if i find a solution, anybody else who did fix this can be of quick support to us.

Now the Mixed Content issue is solved, it require secure: true and both my web site and peerjs-server should be loaded over a secure HTTPS connection

var peer = new Peer({
  host: "my_peerjs_server_with_ssl_cert",
  secure: true,
  path: '/peerjs'
});
javac0d3 commented 4 years ago

I had set this to true earlier, however i had a different issue which was related to certificate, I had pointed to a wrong certificate. By the way, i did install the turnserver on my localsystem and using the same instead of google. Anyways thanks for update. - Yeshwanth Hegde K

javac0d3 commented 4 years ago

I do have a similar issue with Mixed content after setting the secure to false, the Id does not get delivered to client. Will keep posted if i find a solution, anybody else who did fix this can be of quick support to us.

Now the Mixed Content issue is solved, it require secure: true and both my web site and peerjs-server should be loaded over a secure HTTPS connection

var peer = new Peer({
  host: "my_peerjs_server_with_ssl_cert",
  secure: true,
  path: '/peerjs'
});

I did set the secure: true, however realised my issue was a bit different as i had pointed to a wrong certificate file once this was done got the issue solved. In the process I did went ahead and installed turnserver locally and now entire feature works without anyissue. Thanks for update. ,

sugoireed commented 2 years ago

You can host your own peerjs .js file on your server and start it using node peer.js. tha path can be /myapp and port 3000

Ensure you specify the sssl key and cert if your domain uses https. Then on your client side connect like this

        peer= new Peer({
                  host:'YOUR DOMAIN..XXXX.com',
                  key:'peerjs',
                  port:3000,
                  path:'/myapp',
                  debug:3,
                  secure:true,
                  config: { 'iceServers': [
                                  { url: 'stun:stun.l.google.com:19302' },
                                  { url: 'turn:numb.viagenie.ca:3478', credential: 'muazkh', username:'webrtc@live.com'},
                                  { url: 'turn:numb.viagenie.ca', credential: 'muazkh', username:'webrtc@live.com' },
                                  { url: 'turn:192.158.29.39:3478?transport=udp', credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', username:'28224511:1379330808' },
                                  { url: 'turn:192.158.29.39:3478?transport=tcp', credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', username:'28224511:1379330808' },
                                  { url: 'turn:13.250.13.83:3478?transport=udp', credential: 'YzYNCouZM1mhqhmseWk6=', username:'YzYNCouZM1mhqhmseWk6' }

                  ]
                }

  });