TerriaJS / TerriaMap

Catalog-based web geospatial visualisation platform.
https://terria.io
Apache License 2.0
324 stars 255 forks source link

CORS Issue - Add Web Data #413

Closed KoalaGeo closed 4 years ago

KoalaGeo commented 4 years ago

Hi,

Tried today to use Terria to add web data from couple of services (http://ogc.bgs.ac.uk/cgi-bin/TFL-PSI/ows & http://ogc.bgs.ac.uk/cgi-bin/TFL-PSI/ows) on servers where we've enabled CORS:

header set Access-Control-Allow-Origin "*"

WMS GetCapabilities request shows the server is giving ~ Access-Control-Allow-Origin: * :

GET http://ogc.bgs.ac.uk/cgi-bin/TFL-PSI/ows?service=WMS&request=GetCapabilities& HTTP/1.1
Host: ogc.bgs.ac.uk
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 OPR/65.0.3467.78
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Referer: http://ogc.bgs.ac.uk/BGS_ESA_EN_Terrafirma/
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

HTTP/1.1 200 OK
Date: Mon, 20 Jan 2020 11:34:18 GMT
Server: Apache
Access-Control-Allow-Origin: *
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/xml; charset=UTF-8 

But the layers aren't coming in....still getting a CORS error popup...

steve9164 commented 4 years ago

The first of those URLs is working for me: http://ci.terria.io/master/#share=s-tT5ChTAhhKfXM3RwLHNzX3Hy6Zl

KoalaGeo commented 4 years ago

Interesting. However they don't work on https://map.terria.io/....

steve9164 commented 4 years ago

In the case of https://map.terria.io it's blocked by the browser for mixed content since it's on an http URL and https://map.terria.io is secure.