WebRTC-Experiment icon indicating copy to clipboard operation
WebRTC-Experiment copied to clipboard

RTCMulticonnection/Scalable Broadcasting CORS error?

Open rayj00 opened this issue 4 years ago • 3 comments

Anyone else run into this:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:9001/socket.io/?userid=152c4qzg1dmjg1y8igw…imitPerUser=1&extra=%7B%7D&EIO=3&transport=polling&t=N8vEBNE. (Reason: CORS request did not succeed).

If I use connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/'; it works fine. So how to allow CORS for localhost:9001?

How to fix?

Thanks.

rayj00 avatar May 21 '20 21:05 rayj00

hi i have same problem how you resolve this

vcluo avatar May 19 '21 07:05 vcluo

I am using haproxy and SSL so this may not work for you.

use letsencrypt for SSL and here is the config.json I use;

{ "socketURL": "/", "dirPath": "", "homePage": "index.html", "viewerPage": "viewer.html", "socketMessageEvent": "RTCMultiConnection-Message", "socketCustomEvent": "RTCMultiConnection-Custom-Message", "port": "9001", "enableLogs": "true", "autoRebootServerOnFailure": "false", "isUseHTTPs": "false", "sslKey": "fake-keys/privatekey.pem", "sslCert": "fake-keys/certificate.pem", "sslCabundle": "", "enableAdmin": "true", "adminUserName": "", "adminPassword": "", "broadcaster": "bcaster", "viewers": "viewer" }

Comment out the following line in .html file: // connection.socketURL =

rayj00 avatar May 19 '21 11:05 rayj00

hi i try your way, not work . but i look the stackoverflow answer it's work for me
ioServer(httpApp) change after ioServer(httpApp,{ cors: true })

holp this can be help you

vcluo avatar May 20 '21 02:05 vcluo