Hard time with CORS error

Currently, I downloaded the OpenBitu on-premise guide to ec2 and proceeded with ./openvidu start.

The request for “https://url:8443/openvidu/api/sessions” on the client end (currently localhost:3000) is then blocked by CORS.

In another article, I understand that the implementation of the openvidu server already has a way to handle the corresponding CORS, so could you tell me why this problem occurs?

I’m currently testing based on the work I’ve done through openvidutual. (with React.js)



async createSession(sessionId) {
    const response = await axios.post(
      APPLICATION_SERVER_URL + "api/sessions",
      { customSessionId: sessionId },
      {
        headers: {
          Accept: "application/json",
          Authorization:
            "Basic " + Buffer.from("OPENVIDUAPP:ov109").toString("base64"),
          "Content-Type": "application/json",
          "Access-Control-Allow-Origin": "*",
          "Access-Control-Allow-Methods": "GET,PUT,POST,DELETE,PATCH,OPTIONS",
        },
      }
    );
    return response.data; // The sessionId
  }

  async createToken(sessionId) {
    const response = await axios.post(
      APPLICATION_SERVER_URL + "api/sessions/" + sessionId + "/connections",
      { customSessionId: sessionId },
      {
        headers: {
          Accept: "application/json",
          Authorization:
            "Basic " + Buffer.from("OPENVIDUAPP:ov109").toString("base64"),
          "Content-Type": "application/json",
          "Access-Control-Allow-Origin": "*",
          "Access-Control-Allow-Methods": "GET,PUT,POST,DELETE,PATCH,OPTIONS",
        },
      }
    );
    return response.data; // The token
  }


This must be a networking missconfiguration in your custom EC2 deployment. As you said, OpenVidu deployment is configured to allow CORS by default, so the cause must be an element placed in front of the deployment. I’d carefully review your networking config.
PS: if you are deploying in AWS, please note that you have official AWS native deployments for all OpenVidu tiers that deal with these complexities. See OpenVidu for production on AWS.