OpenVidu / openvidu-local-deployment

Docker compose to run OpenVidu locally for development purposes
5 stars 3 forks source link

How to enable CORS for external web applications in OpenVidu Call backend? #2

Open AoEiuV020 opened 17 hours ago

AoEiuV020 commented 17 hours ago

I am using the OpenVidu local deployment with the provided OpenVidu Call application. I would like to interact with the backend of the OpenVidu Call project from an external web application (e.g., creating or joining rooms through API calls). However, I'm encountering CORS (Cross-Origin Resource Sharing) errors when attempting to make requests from my web application.

Could you provide guidance or instructions on how to configure the OpenVidu Call backend to allow CORS so that external web applications can interact with the API?

Steps to Reproduce:

Deploy OpenVidu locally using openvidu-local-deployment. Attempt to send a POST request from an external web app to the API endpoint (e.g., /api/rooms) using fetch or axios. Observe CORS error in the browser console. Expected behavior: The backend should respond to the API request without triggering CORS errors, or there should be a clear configuration option to enable CORS for the OpenVidu Call backend.

Current behavior: CORS errors prevent the external web application from successfully making requests to the backend.

Request: Could you provide guidance on how to configure the OpenVidu Call backend (or its server) to allow external web applications to make API calls (e.g., through headers such as Access-Control-Allow-Origin)?

Thank you for your help!

cruizba commented 16 hours ago

We will create an env variable to control this. Thanks for feedback!

At the moment, if you use TESTING_MODE as an env variable of the Call Backend, the CORS is configured to *