KIBANA Can't Download GeoJSON Map Even After Enabling CORS

Hello all,

I am trying to create a custom regional map in Kibana. I have imported the necessary GeoJSON map into Kibana. I have also joined the proper field in the GeoJSON file to match the appropriate field in the corresponding Elastic Search index pattern.

However, I keep getting the following error :

Cannot download http://localhost:8000/Liberian_Counties.geojson file. Please ensure the CORS configuration of the server permits requests from the Kibana application on this host .

I have enabled CORS in the Elastic Search YML file but the error still persists.

My Kibana Configuration Settings for the custom map is shown below:

Custom Region Maps

regionmap:
layers:
- name: "Liberian Counties"
url: "http://localhost:8000/Liberian_Counties.geojson"
# attribution: "https://exploratory.io/maps"
fields:
- name: "CNAME2K"
description: "County Name"

My Elastic Search Configuration Settings for enabling CORS is shown below:

http.cors.enabled:true

http.cors.allow-origin: /https?://localhost(:[0-9]+)?/

I haved also checked the values in both the elasticsearch index pattern and the values in the GeoJSON file to ensure that they are exactly the same. However, the error still persists.

I would be grateful if anyone could please help to solve this problem as I am at a crossroad.

Thank You.

Richard

Kibana can not use Elasticsearch as the web server for GeoJSON files. You should host your GeoJSON files using an external web server such as the http-server Node.js library. There are more details in this blog post.

@nickpeihl Hi,

Thanks for your mail. I already hosted my geojson files via http server from Day 1. However, the error still persists.

I hosted my GeoJSON file with the following http-server in the same directory as my GEOJSON file as was instructed on the elastic search website using the following command line statement :

http-server --cors='*' -p 8000

I would be grateful if you could help with a solution.

Thank You

Richard

Can you try http-server --cors="kbn-version" -p 8000 and see if that helps? I think recent versions of http-server are more strict about accepting headers.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.