CORS Policy JS error

Chris Viehoff asked on August 15, 2019

After following the install guide (Windows) I get an error when I try to access a index in the Pivot Table:
In the console it shows:
Access to XMLHttpRequest at ‘http://localhost:9200/_cat/indices?bytes=k&v=true&format=json’ from origin ‘http://localhost:5601’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
I verified the config files and see no issue. Any other suggestions?
 
 

Attachments:
FlexMonsterJS.PNG

5 answers

Public
Chris Viehoff August 15, 2019

Additional information. elasticsearch.yml file

Attachments:
flexmonster-yml.PNG

Public
Tanya Gryshko Flexmonster August 15, 2019

Hi Chris!
Thank you for the question.
It looks like you have to add a few lines in kibana.yml as well
Please open kibana.yml and add the following configuration:

elasticsearch.hosts: ["http://localhost:9200"]
server.cors: true
server.cors.origin: ['*']

Does it work for you?
Thanks,
Tanya

Public
Chris Viehoff August 15, 2019

Additional File kibana.yml

Public
Dmytro Zvazhii Flexmonster August 16, 2019

Hello Chris,
Thank you for reaching out.
It seems like everything is fine with your configuration files but it’s still a problem with CORS.This issue in Kibana is a real pain in the neck.

To resolve the problem please try the following.
Restart Kibana and Elasticsearch.
If you have several instances check in the task manager if there is any processes are still runnig.
Open elasticsearch.yml and remove all whitespaces between commas if any.
Check if Kibana and Elasticsearch has the most compatible versions.

I hope this will help.
Please let us know if you managed to resolve it.
Regards,
Dmytro

Public
Dmytro Zvazhii Flexmonster 4 days ago

Hello Chris,

Some developers of ours have recently faced a similar issue when installing Elasticsearch tools. That is not the issue of Flexmonster Kibana plugin itself but a conflict between Elasticsearch parts. To overcome that, we have prepared the ultimate approach of ours.
Please find the recommended steps below:
1. Please uninstall the Elasticsearch. Make sure that there are no other versions of Elasticsearch running.
2. Install Elasticsearch 7.3.0 as a service. You can follow the steps from the original Elasticsearch guide: https://www.elastic.co/guide/en/elasticsearch/reference/current/windows.html.
3. Download Kibana 7.3.0 Package if it was deleted: https://www.elastic.co/guide/en/kibana/current/windows.html.
4. Apply CORS configs: 

elasticsearch.yml

http.cors.enabled : true
http.cors.allow-origin : “*”
http.cors.allow-credentials: true
http.cors.allow-methods : OPTIONS,HEAD,GET,POST,PUT,DELETE
http.cors.allow-headers : kbn-version,Origin,X-Requested-With,Content-Type,Accept,Engaged-Auth-Token,Content-Length,Authorization

kibana.yml

elasticsearch.hosts: ["http://localhost:9200"]
server.cors: true
server.cors.origin: [‘*’]

5. Restart Elasticsearch service to apply configs. Services -> Elasticsearch -> Restart.
6. Install Flexmonster Plugin:

./bin/kibana-plugin install https://github.com/flexmonster/pivot-kibana/releases/download/v1.17/flexmonster_pivot-v1.17.zip
cd plugins/flexmonster_pivot
yarn upgrade

7. Start Kibana.

The steps above allowed us to install and run the plugin as expected from the first time.

Please let us know if the information above helped to resolve the issue.
Regards,
Dmytro

Please login or Register to Submit Answer