cross domain - Mapbox: How to solve CORS issue in map.addSource() -


i'm trying mapbox examples , notably this one. when example tries geojson points following code:

map.addsource("earthquakes", {     type: "geojson",     // point geojson data. example visualizes m1.0+ earthquakes     // 12/22/15 1/21/16 logged usgs' earthquake hazards program.     data: "https://www.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson",     cluster: true,     clustermaxzoom: 15, // max zoom cluster points on     clusterradius: 20 // use small cluster radius heatmap }); 

i following error:

blocking cross-origin request: "same origin" policy not allow view remote resource located @ https://www.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson . reason: cors "access-control-allow-origin" header missing.

i saw similar problems add in http header how here?

this mapbox. server saying origin querying not allowed policy (check headers in options request). because policy isn't supporting access-control-allow-origin header, requests made xhr mapbox.com must come mapbox.com.

now conceivably around using proxy server on local vm pretend you're on mapbox.com - using haproxy container, example, on virtual box - , in config setting acl points requests mapbox.com code , rest mapbox.com's ip address. use /etc/hosts pass requests mapbox vm instead , handle there. not simple solution, thought worth pointing out it's possible.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -