socketio / socket.io-p2p

MIT License
1.02k stars 180 forks source link

COR issue #62

Open savethehousemouse opened 4 years ago

savethehousemouse commented 4 years ago

Using the example chat unchanged I receive a "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://file/socket.io/?EIO=3&transport=polling&t=My7DERo. (Reason: CORS request did not succeed)."

message. Looking around for enabling CORS I found a few tips like: app.options('*', cors()) // include before other routes app.use(cors({origin: 'http://localhost:3000', }));

but I do not see where and how I can enable it in this app.

It would be great if you would COR enable the example app since it would make the example work again and I could learn how to use the solution in my app based on your example.

Thank you in advance g strubinsky

Kothapalliprakash commented 3 weeks ago

app.use(cors({ origin: " " })); app.options(' ', cors());

I don't know whether you resolved this error or not. But, I overcame this issue by doing this.