CORS Error on setting up standalone livechat widget

I am trying to clone and customise the livechat widget of rocketchat. On setting up the widget and hitting from my local server it gives me CORS error on port 3000 (where live chat apis are served from). I am serving widget-demo.html from localhost:5500. The error says

Access to fetch at 'http://localhost:3000/api/v1/livechat/page.visited' from origin 'http://localhost:8080' 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. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Hey, you can disable the CORS checks in settings. I think it’s in Administration > General

1 Like

But how do you handle when the app is deployed.?

You will need to host your custom livechat widget externally.

I have set up a project on my local machine using Docker. Now, I want to access the API in my React.js project. However, I am encountering an error locally.

As you mentioned, it’s already disabled, but I am still encountering a CORS error.

Do you have any ideas on how to fix this?