Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

api CORS issue from jira rest api to sonarqube

Hi Community,

I've the following ajax call from confluence to sonarqube:

// Sonarqube data AJS.$.ajax({ url: 'https://sonarqube.xx/api/prometheus/metrics', type: 'GET', dataType: 'json', "crossDomain": true, 'cache': false, contentType: 'application/json', beforeSend: function(xhr) { xhr.setRequestHeader('Authorization', "Basic " + btoa("xx" + ':' + "xx")); }, headers: { "Authorization": "Basic " + btoa("prom" + ':' + "prom"), "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, PATCH, PUT, DELETE, OPTIONS", "Access-Control-Allow-Headers": "Origin, Content-Type, X-Auth-Token", "Access-Control-Expose-Headers": "Content-Length, X-JSON" }, success: function(json) { console.log(json) }, error: function(err) { console.log(err) } });

however, I'm getting the following error:

Access to XMLHttpRequest at xx from origin '' 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.

I was informed by the sonarqube admins that its not possible to add CORS on the sonarqube side. Is there still a way to get sonarqube data.
Please note that postman access to the sonarqube is fine using basic authorization.

Thanks in advance



Log in or Sign up to comment

Atlassian Community Events