NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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's gravatar image

gf_eu
26112
accept rate: 0%

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?

(02 Mar '20, 09:16) gf_eu

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.

(04 Mar '20, 10:48) gf_eu

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.

(04 Mar '20, 15:23) H_mlet

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.

permanent link

answered 28 Feb '20, 22:32

H_mlet's gravatar image

H_mlet
5.4k1781
accept rate: 13%

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...

permanent link

answered 02 Mar '20, 18:43

H_mlet's gravatar image

H_mlet
5.4k1781
accept rate: 13%

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({
   type : "GET",
   url : 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer',
   success : function(data) {
   init();
   }
   });

Only after this request is done I initialize the map (method init):

function init(){
   ...
   layer = new ol.layer.Tile({
   source: new ol.source.XYZ({
   attributions: 'Tiles ' +
'rest/services/World_Topo_Map/MapServer">ArcGIS',
   url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' +
   'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
   })
   });
   map = new ol.Map({
      target: 'map',
      layers: [layer, vector],
      view: new ol.View({
      center: ol.proj.fromLonLat([...]),
      zoom: 5
   })
   });
   ...
   }

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×710
×293
×287
×20
×14

question asked: 28 Feb '20, 13:46

question was seen: 4,697 times

last updated: 04 Mar '20, 16:29

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum