Testing WMS response get CORS error
PBrockmann opened this issue · comments
I would like to test locally on my laptop the last snapshot of the TDS server and I am struggling with CORS or bad answers from the TDS server when I make requests from my page exposed on my local http server.
I think it could be interesting to explain how to quiclky test a TDS with a simple http server.
Here is what has been made.
I have run the TDS instance with a
docker run -d -p 80:8080 unidata/thredds-docker
Also run a http server from python
python -m http.server 8080
I have from my google chrome brower enable CORS '*' request.
Then from my html file when I make a WMS request I get a 403 error ?
What do I miss ?
<script>
$(document).ready(function() {
var ressource = "http://0.0.0.0/thredds/wms/testAll/2004050412_eta_211.nc?service=WMS&version=1.3.0&request=GetCapabilities";
$.get({url: ressource,
async: false
}, function(xml) {
console.log(xml);
});
});
</script>
Solved by using
google-chrome -user-data-dir=/my/dir --disable-web-security
run python http_cors.py 8080
to get a http server.
and docker-compose up thredds-production
to get the TDS.
with a docker-compose.yml as following
version: '3'
services:
thredds-production:
image: unidata/thredds-docker:latest
ports:
- "80:8080"
- "443:8443"
- "8443:8443"
volumes:
- /my/path/file1.nc:/usr/local/tomcat/content/thredds/public/testdata/file1.nc
- /my/path/file2.nc:/usr/local/tomcat/content/thredds/public/testdata/file2.nc