I’m trying to hit my SonarQube container’s web API from a React app and am getting:
“Access to XMLHttpRequest at … 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.”
Sure. I actually got it to work by putting both my react app and the SonarQube container behind a reverse proxy so that they could both be called using localhost:8080. The API call was authenticated properly after I logged into SonarQube, and I stopped receiving the CORS error. But I’d be interested in hearing of other potential solutions / suggestions as well. This is the call:
const { data } = await axios.get(
"http://localhost:8080/api/issues/search?componentKeys=my_app&resolved=false"
);