Kibana can't download the .geojson file from the localhost

Hello. I've been trying to use the regionmap feature of Kibana with a custom geojson file. The file is in the same container as Kibana. I installed http-server and started it. If I curl the localhost:port/file.geojson, I get the data printed out, however, I get the following error in the browser with the Kibana URL:

Error downloading vector data
Cannot download http://localhost:9999/Chile.geojson file. Please ensure the CORS configuration of the server permits requests from the Kibana application on this host.

The elk-docker was used for the installation in the server.

If anyone could help me to get this running, I would really appreciate it. Thanks!

Additional info:
http-server parameters:

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

Kibana.yml:

server.name: kibana
server.host: "0.0.0.0"
server.cors: true
server.cors.origin: ['*']
elasticsearch.url: http://elasticsearch:9200
regionmap:
layers:
- name: "Chile"
url: "http://localhost:9999/Chile.geojson"
attribution: "https://github.com/jlhonora/geo"
fields:
- name: "CIR_SENA"
description: "Cir sena"
- name: "COD_COMUNA"
description: "Codigo de la comuna"
- name: "DIS_ELEC"
description: "Dis elec"
- name: "NOM_COM"
description: "Nombre de la comuna"
- name: "NOM_PROV"
description: "Nombre de la provincia"
- name: "NOM_REG"
description: "Nombre de la region"
- name: "SHAPE_Area"
description: "Shape area"
- name: "SHAPE_LENG"
description: "Shape leng"
- name: "SHAPE_Le_1"
description: "Shape le 1"

Elasticsearch.yml

cluster.name: "docker-cluster"
network.host: "0.0.0.0"
http.cors.enabled: true
discovery.zen.minimum_master_nodes: 1
discovery.type: single-node

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

1 Like

I did try that a couple of times, now it works though.

For some reason, I was just unable to read the file with Kibana from inside the container (Eventhough it actually had the file, and I could curl it without any issue), however, it could read it without problems from outside the container (In a server folder), so the only changes where on the kibana.yml file, with an updated url of the server (Instead of just localhost), and your exact http-server code for hosting it.

Once I started reading the vector map, the upcoming errors were pretty small/easy to fix (Faulty index pattern, not linking the proper files in the option tab on the visualize page, etc).

I hope this configurations and explanations help someone else. Thanks for the answer!

1 Like

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