Hi everyone.
We are using esri-leaflet to enable Satellite Imagery in our maps. We have noticed that the layer attributions cannot be loaded because of CORS related issues.
Browser Errors:
Request/Response:
First I thought it is an issue on our side, the I thought it is an issue on esri-leaflet, but after diggig deeper it simply seems that the "static.arcgis.com" API endpoint (in this case https://static.arcgis.com/attribution/World_Imagery?f=json) does not send the required CORS header to function properly on websites. On the same page we also call some of our own APIs without CORS issues so the general browser setup and security policies are fine. The request headers are also the same. It's purely the arcgis server not sending the headers in the response.
Is this a known issue? I have found some CORS related posts on this forum but nothing directly confirming this.
Kind Regards
Danel
Solved! Go to Solution.
It seems the problem on the ArcGis/Cloudfront side was resolved since my post. I just realized that X-Cache header reported an "Error from cloudfront" and the CORS headers were missing. I wanted to prepare a sample today, but then realized that the CORS headers are now back alive and "x-cache" also rather contains "Hit from cloudfront".
According to the following link the "x-cache: error on cloudfront" happens when there is some issue on the server side. I guess this issue was now resolved. Let's hope it stays like that.
https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-custom-object-caching/
Thanks for your answers anyhow.
Daniel, could you please share the leaflet code that is causing that issue?
Assuming you're debugging application on localhost which requesting the https://static.arcgis.com/attribution/World_Imagery?f=json.
then you might try setup proxy first if haven't done yet
https://developers.arcgis.com/javascript/latest/proxies/
Thanks for the hint, but unfortunately this is going a bit into a wrong direction:
We are not using the ArcGis Map component, we are using Leaflet. The link you shared is not applying for Leaflet + Esri-Leaflet.
It seems the problem on the ArcGis/Cloudfront side was resolved since my post. I just realized that X-Cache header reported an "Error from cloudfront" and the CORS headers were missing. I wanted to prepare a sample today, but then realized that the CORS headers are now back alive and "x-cache" also rather contains "Hit from cloudfront".
According to the following link the "x-cache: error on cloudfront" happens when there is some issue on the server side. I guess this issue was now resolved. Let's hope it stays like that.
https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-custom-object-caching/
Thanks for your answers anyhow.