oscarfonts / docker-geoserver

MIT License
87 stars 50 forks source link

CORS cannot be enabled using environment variable #44

Open trepmag opened 3 months ago

trepmag commented 3 months ago

I noticed that CORS cannot be enabled using the environment variables since the start.sh script is looking up for the absence of some <filter-name>cross-origin string (see start.sh) in the web.xml file which isn't the case as what I can observe here.

The quick fix is to mount a version of the web.xml file by un-commenting those existing cors chunks ...

KrzysztofGalecki-TomTom commented 3 days ago

Hi - I've just spent few hours on that before I found this issue. This is 100% correct. As for current implementation you are unable to configure CORS anyhow. I would suggest to revert this commit - at least for geoserver versions which contains <filter-name>cross-origin in web.xml file - otherwise it will not work.

As a workaround you can add this sed command which adds cors filtering in web.xml as an additional step in your launching script under a condition of GEOSERVER_CORS_ENABLED only (for example as a part of your own Dockerfile based on this one)