When I go here: https://openlayers.org/en/latest/examples/canvas-tiles.html many times I receive this kind of error: https://a.tile.openstreetmap.org/2/0/3.png net::ERR_TUNNEL_CONNECTION_FAILED (Chrome) Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://a.tile.openstreetmap.org/3/0/3.png. (Reason: CORS request did not succeed). (Firefox) It depends on my proxy or it is a temporary problem on the server? P.S. I am doing a test with an HTML on my machine copying the code on the example Thanks. asked 28 Feb '20, 13:46 gf_eu |
I guess the "Cross-Origin Request Blocked" error might because you're loading your HTML via http, and the tiles via https. Unfortunately the main OSM servers don't provide http anymore. The problem should only happen in the reverse situation... I tried with leafletjs, it works fine. I won't install npm to try the OpenLayer code, but it should be similar. Did you try with "codesanbox" ? (the Edit button at top right of your example page) It also works fine for me. For the server status, you can check https://a.tile.openstreetmap.org/, to get the name of your tile server, then on https://hardware.openstreetmap.org/ you'll find a munin link, with all the stats. You can also check the Headers (x-cache) to find the tile cache server (proxy) that served you, and check it the same way. Hope this helps. answered 28 Feb '20, 22:32 H_mlet |
It might be a problem with your connection, but I notice on https://uptime.openstreetmap.org/ that trogdor and necrosan are not the most stable tile cache servers. On the other hand, there is a ticket at the OSM Operation Team that looks like your problem, maybe you could help them with more data. First try on https://www.openstreetmap.org/ to check that you can reproduce the problem. Of course if you're happy with ArcGIS license and data, please use them... answered 02 Mar '20, 18:43 H_mlet Answer to H_mlet. Yes, there is a proxy on my side. And also using ARCGis Tiles I am having ERR_TUNNEL_CONNECTION_FAILED, even I am not sure yet it's the exact same error as with OSM Tiles. What I did now, my workaround, is to "force a Internet request" before everything (I chose to use the same ARCGIS Map url but I could use everything on the web): $.ajax({ Only after this request is done I initialize the map (method init): function init(){ What happen now: when I open the HTML first thing the browser does is to ask me the proxy credentials, after the map is loaded and the map works correctly. I am not having any ERR_TUNNEL_CONNECTION_FAILED. If this is a workaround can work also with OSM Tiles and outside of proxy connection I can't say yet....If I do a test I will tell you. I suppose that there is a problem in the Open Layer Javascript but It can be I will be happy with this workaround... Hope this can help...and can make any sense for you.
(04 Mar '20, 16:25)
gf_eu
Well I don't really understand, but I'm glad you found a workaround, and thanks for sharing. :-) Anyway it looks more like a bug of OpenLayers, you might want to report it to them : https://github.com/openlayers/openlayers/issues Regards
(04 Mar '20, 16:29)
H_mlet
|
Actually the problem is also when I load this example: https://openlayers.org/en/latest/examples/canvas-tiles.html. But it doesn't happen always, just sometime.
Now for example I am having this ok:
https://b.tile.openstreetmap.org/8/140/128.png via: 1.1 trogdor.openstreetmap.org (squid/4.10) x-cache: MISS from trogdor.openstreetmap.org
and this other on error https://c.tile.openstreetmap.org/8/140/129.png
And this cause me problem in viewing the map in some point. And yes, looks I have the same problem with codesanbox, here for example:
https://b.tile.openstreetmap.org/13/4590/4150.png x-cache: MISS from necrosan.openstreetmap.org
Now I am noticing that I don't have any problem with ARCGis Tiles (either on the example, either on my local file) and I replaced this:
source: new ol.source.OSM()
with this:
source: new ol.source.XYZ({ attributions: 'Tiles © ArcGIS', url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' + 'World_Topo_Map/MapServer/tile/{z}/{y}/{x}' })
What do you suggest? To do some investigation or keep going with ARCGis Tiles that work well for me?
Ok, I have some information more, I am going to update that ticket, maybe we can find (and give help). And It looks I have the same problem with ARCGis Tiles.
Basically when I open the HTML (before the map is loaded), sometime the page ask me for the proxy credentials, sometimes not (I don't know what's the logic but it's about cache). When the page ask for proxy credentials and I insert them everything works fine otherwise I have that error (Open Layer Engine seems to be "offline", piece of the map are shown sometime depending on what there is in the cache I guess).
But also, even when is "offline" (and not working) sometime (but rarely) doing "Zoom In" and "Zoom out" the browser (not always) ask me for proxy credentials and the Open Layer Engine come "back online" and start to work again.
Now...as workaround maybe I can think about do a "request on the Internet" before loading everything or I don't know "skip the cache" (I tried with the meta tag but nothing). Any idea?
Thanks again.
I'm not sure I understand your problem.
When you say that a proxy ask for credentials, it's a proxy on your side ? Not the tile cache server ?
Maybe there a problem with chaining proxies...
Does openstreetmap.org work with your setup ?
Could you give a bit more details ?
Regards.