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.
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>
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.
It should be initiated at the beginning before all the actual request.
Can't see it. As an example can you see it in the esri sandbox url I posted above?
Hi, if you keep the network tab open and click on f5 to refresh. Then you right click to save as har file, I can have a look.
Hi, looks like it didn't send the preflight request as it is a simple request. I am stumped sorry
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.ti...
But I'm not getting back any response headers for access-control.
I would expect to see something like this.
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.
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