# Hard time with CORS error

**URL:** <https://openvidu.discourse.group/t/hard-time-with-cors-error/4408>\
**Category:** Issues developing apps\
**Tags:** v2\
**Created:** [February 2, 2023, 7:25am UTC](https://openvidu.discourse.group/t/hard-time-with-cors-error/4408 "2023-02-02T07:25:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dudukim](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/dudukim/32/2145_2.png) [@dudukim](https://openvidu.discourse.group/u/dudukim)\
**Post date:** [February 2, 2023, 7:25am UTC](https://openvidu.discourse.group/t/hard-time-with-cors-error/4408/1 "2023-02-02T07:25:11Z")

</div>

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

The request for “[https://url:8443/openvidu/api/sessions](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)

```plaintext

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
  }

```

 ![image](https://global.discourse-cdn.com/free1/uploads/openvidu/original/2X/6/62333e4d761077cd3bfa15c96040c925dccf4342.png)

---

<div class="post-metadata">

**Author:** ![pabloFuente](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/pablofuente/32/2536_2.png) [@pabloFuente](https://openvidu.discourse.group/u/pabloFuente)\
**Post date:** [February 7, 2023, 10:36am UTC](https://openvidu.discourse.group/t/hard-time-with-cors-error/4408/2 "2023-02-07T10:36:15Z")

</div>

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**](https://docs.openvidu.io/en/stable/deployment/#openvidu-for-production-on-aws).
