I have a puzzling problem: I'm using Leaflet on an internal webpage to show a map with some custom layers.
Say, the webpage sits on the internal server showdata.local
. The map tiles come from another internal server named maps.local
. Leaflet finds the tiles perfectly given the appropriate tile URL http://
maps.local/terraintiles/{z}_{x}_{y}.png
. - So Leaflet's JavaScript (running in the browser) can clearly retrieve the images from the tile server maps.local
. So far so good.
Now I am trying some Leaflet plugins to export on the client (i.e. the browser) the map (with the custom layers) as an image. I tried Leaflet.BigImage and leaflet-image. - But in both plugins, when I try to export the map, I get CORS errors on the tiles URLs. I assume the plugins need to retrieve the tiles again to build a virtual canvas with the map on it.
What I do not understand: Why do I get the CORS error in the plugins, but Leaflet's JavaScript code can load the tiles freely? Shouldn't be both disallowed if the tile server does not allow CORS?