How do you by pass the Cross-Origin Resource Sharing error you get when you try to access REST plugin from jquery

I have created a plugin which sends json data back I am getting an error when accessing from jquery cross-origin resource sharing  saying that request is coming from another domain  . I used jsonp but cannot use application/javascript or MediaType.TEXT_HTML as the server is throwing a 500 error saying this format is not supported

Is there any way to bypass CROS with either setting in JIRA or jquery

 

1 answer

Got it need to set the 

contentType ="application/x-www-form-urlencoded; charset=utf-8" 

 

and set 

response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with");

 

in server

Where do I have to set response.Header.... in server? Can you describe it more specific?

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 ...

2,781 views 11 18
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