I keep getting the following CORS error while trying to use the JIRA ReST API:
The Fetch API does not load https://jira.our-domain-name.com/jira/rest/api/2/search?jql=project=tcc%20and%20cf[10809β ~8423362 . The response to the preflight request does not pass the access control check: No The header of the Access-Control-Allow-Origin header is present in the requested resource. The origin of https://application-url.our-domain-name.com 'is therefore not allowed access. If an opaque response meets your needs, set the request to "no-cors" mode to retrieve the resource with CORS disabled.
However, this search URL works 100% when I paste it directly into the browser or launch it through Postman or using CURL from the command line.
My application calls the API using the javascript fetchAPI. When creating a GET request, I set the following headers:
headers: {
"content-type": "application/json",
"authorization": "Basic <<encrypted>>"
}
I made sure that the requesting node was allocated in the JIRA administrator - I tested the host using the test function on the whitelist page.
When I change the whitelist from a wildcard to a domain name, I suddenly get the following:
The Fetch API does not load https://jira.our-domain-name.com/jira/rest/api/2/search?jql=project=tcc%20and%20cf[10809β ~8423362 . Resolution of the request header field is not allowed by Access-Control-Allow-Headers in the preflight response.
Any ideas?