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

Pramod Kutty June 11, 2015

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

0 votes
Pramod Kutty June 11, 2015

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

Franziska Witt August 3, 2016

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