Axios request blocked by cors even if another one just passed

Viewed 33

I have two axios requests like this :

axios
    .post(
      `myUrl`,
      
        data,

      {
      
        headers: {
          "Content-Type": "application/json",
        },
      }
    ).then((res) => {

data = res.data
      axios
    .post(
      `otherUrl`,
      
        data,

      {
      
        headers: {
          "Content-Type": "application/json",
        },
      }
    ).then((res) => {
      console.log(res);
    })
    })

The first axios request is ok and get a backend response, but the second is blocked by cors.

How is it possible ?

Whatever url I use and whatever data I try to pass in second axios, it is always blocked.

Concerning the backend, all url are authorized to access data, but of course, the two axios request come from the same ^^.

The cors error is :

Access to XMLHttpRequest at 'myAPIurl' from origin 'http://localhost:19006' 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.
0 Answers
Related