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
4,362,537
Community Members
 
Community Events
168
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 'https://www.xx.de' 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

0 comments

Comment

Log in or Sign up to comment
TAGS

Atlassian Community Events