CORS working in IE but not in Chrome Edited

Hello,

 

i am currently working on integrating JIRA with my application that is hosted on my SharePoint site. i create an angular app that lets user create JIRA issue from the form. i have already added my sharepoint site as a domain name and wildcard expression in the Whitelist of JIRA security settings bur after doing that it seems that its only working in IE. When i try to remove (xhr.setRequestHeader('Authorization', 'basic: '+make_base_auth(username, password));) in my header i get 400 error but not the CORS error. i think this issue is related to https://jira.atlassian.com/browse/JRASERVER-30371. im not sure i really need to get this to work but im stuck. do we have other workarounds for this?

 

this is my code snippet:

 

 return $.ajax({
	            url: 'https://jira.xxxx.org/rest/api/2/issue/',
	            type: "POST",
	            data: parameters,
	            contentType: 'application/json',
	            dataType: 'JSON',
	            async: false,
	            processData: false,
	            crossDomain: true,
	            xhrFields: {
	            	withCredentials: true
	            },
	            beforeSend: function (xhr) {
	            	xhr.setRequestHeader('Authorization', 'basic: '+make_base_auth(username, password));
            	},
            error: function (errmsg) {
                console.log('error ocured:' + errmsg.statusText);
            },
            success: function (text) {
                console.log(text);
            },

and this is my error in chrome:

 

XMLHttpRequest cannot load https://jira.xxxx.org/rest/api/2/issue/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://xxxx.sharepoint.com' is therefore not allowed access.

 

 

my error in Edge:

SEC7120: Origin https://xxxx.sharepoint.com not found in Access-Control-Allow-Origin header.

SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied.

 

1 answer

0 votes

Hi Page,

I'm not sure about the code you posted, however, there is a knowledge base article titled CORS in JIRA - Server could not be contacted error during Create Issue modal dialog.  It lists the cause as such:

Chrome and Safari include an Origin header on same-origin POST/PUT/DELETE requests (same-origin GET requests will not have an Origin header). Firefox doesn't include an Origin header on same-origin requests.

You can refer to this Communities post for more information.

The knowledge base lists the fix as follows:

Specify Origin as allowed in CORS configuration of JIRA's web.xml:

<init-param>
 <param-name>cors.supportedHeaders</param-name>
 <param-value>Origin</param-value>
</init-param>

See if that helps.

Cheers,

Branden

 

Hi Page,

No worries.  I hope that helps!

Cheers,

Branden

Ive asked our jira server admin to perform the necessary changes.  will update you of it worked. 

Hi @Branden,

may i ask what is the path of the web.xml file to be changed? our server team is asking me.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,156 views 13 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot