Hello,
I created the code below to create issues in Jira from Confluence using HTML Macros with Ajax, but I have the following error:
to XMLHttpRequest at 'http://localhost:8080/rest/api/2/issue/' from origin 'http://localhost:8090' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:8090, http://localhost:8090', but only one is allowed. Access
There is a CORS blocking the URL, I put the confluence address on Jira's whitelist but I didn't succeed
function criarIssue() {
//This creates a issue in jira.
var demanda2 = $("#demanda");
var username = "myuser";
var password = "mypass";
var link2 = $("#link");
var jsondata = { "fields":
{ "project": { "key": "B3B" },
"summary": demanda2.val(),
"description": "[Demanda Externa |" + link2.val() +"]",
"reporter": { "name": AJS.params.remoteUser },
"issuetype": { "name": "DP" }
} }; $.ajax({ type: "POST",
url: "http://localhost:8080/rest/api/2/issue/",
contentType: "application/json; charset=utf-8",
headers: { "Authorization": "Basic " + "blablablablabla==" },
dataType: "json", async: false, data: JSON.stringify(jsondata),
success: function(response) {
dataToReturn = (response["key"]);
console.log('issue created!'); },
error: function(xhr, errorText) { console.log('Error ' + xhr.responseText); } });
return dataToReturn; } Is there a way to resolve this without browsers plugins ?