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?
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
Made it work using a proxy. Thanks.
They do say that their API allows CORS (although maybe not for the tiles): OpenRailwayMap/API - OpenStreetMap Wiki
It did work using Leaflet. Maybe they're just not allowing arcgis somehow.
I don't think cors is enabled on the server. I tried a few different ways.
I tried testing with this site https://www.test-cors.org/#?client_method=GET&client_credentials=false&server_url=https%3A%2F%2Fb.tiles.openrailwaymap.o…
But I'm not getting back any response headers for access-control.
I would expect to see something like this.
https://www.test-cors.org/#?client_method=GET&client_credentials=false&server_url=https%3A%2F%2Fstamen-tiles-a.a.ssl.fastly.net%2Fterrain%2F0%2F0%2F0.png&server_enable=true&server_status=200&server_credentials=false&server_tabs=remote
Sorry I must be doing something wrong, but I don't have any OPTIONS request in my network tab. They're all GET. I tried in every browser.
The response header contain what the setting on your server is and the request header shows what is being send. They have to match up to avoid CORS error
Hi I am doing this on my mobile phone so I can only search for a example online.
See screenshot below. Request method of type options. There should be a response header and a request header. This is a preflight request
<image1.png>
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.
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 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.
Access-Control-Allow-Origin
-Undral
It sounds like it could be a bug.
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.
have you watched the network traffic in your browsers developer tools and ensured it is not trying to use http urls instead of https?
Robert,
Yes I litteraly did that (still not working) :
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"
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.