I want to enable CORS in Geoserver (installed with Tomcat 8). The goal is to access Geoserver maps from Kibana. I made some changes in tomcat/conf/web.xml. But it only works when I install Geoserver + Kibana without Docker. If I use docker-compose, this does not work anymore (Geoserver container crashes):



This is my docker-compose related to Geoserver and Kibana:

    restart: always
    network_mode: "host"
    image: tomcat:8
      - ./geoserver/geoserver/:/usr/local/tomcat/webapps/geoserver
      - ./geoserver/web.xml:/usr/local/tomcat/conf/web.xml
      - 8080

    image: docker.elastic.co/kibana/kibana:5.5.0
    network_mode: "host"
      ELASTICSEARCH_URL: http://localhost:9200
      - ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml
    depends_on: ['elasticsearch']

When I open a map in Kibana, I see the message :

Access to XMLHttpRequest at 'http://localhost:8080/geoserver/test/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=test:MyProvinces&outputFormat=application%2Fjson' 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 am experiencing the exact same problem with the Docker container and CORS. Did you ever solve this issue? – Thibauld Croonenborghs May 3 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.