Hi,
I'm trying to add a layer to my webmap using WebTileLayer and am getting a CORS error message.
Our domain is being
Our server is CORS enabled. I tried to add the url to the trusted servers. I tried adding the Tile Layer using leaflet and it works ok. I tried doing it in the API sandbox, I'm getting CORS messages as well.
Here is the urlTemplate: https://{subDomain}.tiles.openrailwaymap.org/standard/{level}/{col}/{row}.png
Any ideas?
Solved! Go to Solution.
It's the WebGL rendering of the 4x API. WebGL requires CORS, and although that doc says it supports it, I don't think it's working. You could probably get around this with a proxy if you really need it.
This works in 3x https://codepen.io/odoe/pen/bGbzwvz?editors=1000 because 3x isn't fully WebGL
Matthieu,
When you added it to your trusted servers how specific were you with the url? Less specific is preferable i.e. "https://*.tiles.openrailwaysmap.org"
Robert,
Yes I litteraly did that (still not working) :
have you watched the network traffic in your browsers developer tools and ensured it is not trying to use http urls instead of https?
Yes it looks fine, it's using https.
When replacing the url in the sandbox with that railway one (ArcGIS API for JavaScript Sandbox) it seems to throw the same sort of errors.
It sounds like it could be a bug.
Hi there,
It looks like Access-Control-Allow-Origin
is missing from the response header as the errors indicate. This header must be included in all valid CORS responses; omitting the header will cause the CORS request to fail. Please refer to this document for more explanation.
-Undral
Matthieu Thery, with all CORS error, the way to debug your issue is to look at the preflight request. If you look at your network traffic, there is a OPTION request. look at your request header and then the response header and compare. It will tell you what is missing and what is causing your CORS error. If you take a screenshot, I am happy to assist.
Hi, Thanks for helping. Having a look at my network traffic, that is the only thing I get:
I can't see any response headers.