0

Please help .. I'm using laravel websocket (https://beyondco.de/docs/laravel-websockets/getting-started/introduction) for realtime chat .. it's working on my local machine .. but when I deploy to the server .. this is the error say: https://ibb.co/QKxFDmJ

Access to XMLHttpRequest at 'https://sockjs.pusher.com/pusher/app/ABCDEFG/232/15de5kkf/xhr?protocol=7&client=js&version=7.0.3&t=1622612993897&n=52' from origin 'http://ipaddress' 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.
app.js:24458 POST https://sockjs.pusher.com/pusher/app/ABCDEFG/232/15de5kkf/xhr?protocol=7&client=js&version=7.0.3&t=1622612993897&n=52 net::ERR_FAILED[![enter image description here][1]][1]

broadcasting.php

'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'host' => '127.0.0.1',
                'port' => 6001,
                'scheme' => 'http',
            ],
        ],

bootstrap.js

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: process.env.MIX_PUSHER_APP_KEY,
    wsHost: window.location.hostname,
    wsPort: 6001,
    wssPort: 6001,
    disableStats: true,
    forceTLS: true
});
Sam N Den
  • 57
  • 6
  • 13

0 Answers0