Hi,
I am generating the grafana dashboard by call the REST API (spring-REST) using the simple-json-datasource.
I implemented all the required APIs (/, /search, /query) and maintained the contract as expected.
Also, added the CORS as part of response header and even enabled the CORS for the request API by adding the @CrossOrigin at the @RestController.
When i test the APIs, i m getting following header information in the response of the call
{
“access-control-allow-headers”: “Content-Type, Accept”,
“access-control-allow-methods”: “POST, GET”,
“access-control-allow-origin”: “*”,
“connection”: “keep-alive”,
“content-type”: “application/json”,
“date”: “Thu, 14 May 2020 16:51:18 GMT”,
“keep-alive”: “timeout=60”,
“transfer-encoding”: “chunked”,
“vary”: “Origin, Access-Control-Request-Method, Access-Control-Request-Headers”
}
But while creating the datasource, i was getting the below error
Access to XMLHttpRequest at ‘http://localhost:8888/streams/api/’ from origin ‘http://grafana.staged-by-discourse.com’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed.
Input request for the API call is : curl -X GET --header ‘Accept: application/json’ ‘http://localhost:8888/streams/api/’
Any clue?