beyondcode / laravel-websockets

Websockets for Laravel. Done right.
https://beyondco.de/docs/laravel-websockets
MIT License
5.08k stars 628 forks source link

cors issue poped when deployed to vps server on centos #125

Closed ynspc closed 5 years ago

ynspc commented 5 years ago

In local it works fine but when it is hosted in live server, it shows following issue

Access to XMLHttpRequest at 'http://sockjs.pusher.com/pusher/app/myKey/20/2o3o018b/xhr_streaming?protocol=7&client=js&version=4.3.1&t=1551526399491&n=3' from origin 'http://202.51.74.152' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

and

Firefox can’t establish a connection to the server at ws://202.51.74.152:6001/app/myKey?protocol=7&client=js&version=4.3.1&flash=false

Any help is appreciated, thank you.

MartinsOnuoha commented 5 years ago

Has any help been offered regarding this?

francislavoie commented 5 years ago

First, see here: https://docs.beyondco.de/laravel-websockets/1.0/basic-usage/pusher.html#usage-with-laravel-echo you'll need to set disableStats: true to prevent Echo from firing off requests to sockjs.pusher.com.

For the second issue, make sure your port 6001 is open on your server's firewall.

salvationarinze commented 4 years ago

@francislavoie I followed your instructions and I still facing this issue. I deployed on Laravel Forge. It works on localhost and I have set up websockets on forge using the instruction in the docs but still I face this issue. Help please

Screenshot 2020-05-11 at 04 52 43
simar88 commented 3 years ago

Same here, any solution about it?

rickyanwar commented 3 years ago

Same here, any solution about it? pusher work on my computer where the app is installed, but in another device is connected on my local is not work, have an issue with cors image