I am trying to access the backend using this query
fetch("<backend-server-link>", {
method: "POST",
headers: {
"Content-Type": "application/json",
Token: <token>,
},
body: JSON.stringify(payload),
})
But I get this error in my console.
Access to fetch at '< site-name>' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
The backend is hosted on a AWS server. The backend code is in Python an Flask, and I have included CORS in the Flask app. How do I resolve this error?
I tried adding the 'no-cors' mode in the fetch query but it did not work.