living-atlases / generator-living-atlas

An Yeoman Generator for Living Atlas Ansible Inventories
Other
4 stars 5 forks source link

CORS errors between regions and spatial #7

Open vjrj opened 3 years ago

vjrj commented 3 years ago

As reported by @jloomisVCE the are some CORS issues between regions and spatial, with the generated inventories:

regions.vtatlasoflife.org does not support map-clicks due to CORS errors.

In the js console:

/#rt=Vermont%20Counties:1 Access to XMLHttpRequest at 'https://spatial.vtatlasoflife.org/geoserver/ALA/wms?SERVICE=WMS&VERSION=1.1…3817.17417969%2C5175704.05852539%2C-7369752.5181176765%2C5760294.450769044' from origin 'https://regions.vtatlasoflife.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
jloomisVCE commented 3 years ago

I think spatial /geoserver just needs to set ACAO * header.

To test, I just un-commented this line in /etc/nginx/sites-enabled/spatial.vtatlasoflife.org.conf.conf

location /geoserver { ... include /etc/nginx/conf.d/ala_cors_geoserver; }

This fixes the CORS error (for this specific issue). I recall we had some problem with CORS includes, which led to commenting these. I also forget why the vhost fragments don't work, but in those under /etc/nginx/sites-available, the CORS includes are active.

vjrj commented 3 years ago

Can you share with me your vhost for spatial and regions? thanks