Local Grafana + AWS Elastic - 'Access-Control-Allow-Origin': * error

Installed grafana on local machine, ES is on AWS. When I try to connect (create data source), it doesn’t show any error but in the browser console it shows:

Access to XMLHttpRequest at ‘https://xyz.aws.com/table4/_mapping’ from origin ‘http://localhost:8546’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: The value of the ‘Access-Control-Allow-Origin’ header in the response must not be the wildcard ‘*’ when the request’s credentials mode is ‘include’. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

There is absolutely no help on this matter and the client is planning to compare Grafana vs Kibana to get the license for the users. It is urgent! We are looking for a step by step guide on how to resolve this issue.

Thanks

I recommend to read doc about Access config: https://grafana.com/docs/grafana/latest/features/datasources/elasticsearch/

Server (default) = URL needs to be accessible from the Grafana backend/server, Browser = URL needs to be accessible from the browser.

You didn’t make ES URL available from the browser javascript (that is the reason for CORS error). You should switch ES datasource to Server mode, when you are not able to configure ES for Grafana. That will be the simplest fix.