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 Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

421 views 7 5
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