CORS errors on static.arcgis.com

1837
4
Jump to solution
03-22-2021 09:36 AM
kusc3245
New Contributor II

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:

kusc3245_0-1616430535612.png

Request/Response:

kusc3245_2-1616430578433.png

kusc3245_3-1616430616664.png

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

 

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
kusc3245
New Contributor II

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

 

kusc3245_0-1617690087152.png

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. 

 

View solution in original post

0 Kudos
4 Replies
GavinRehkemper
Esri Contributor

Daniel, could you please share the leaflet code that is causing that issue?

0 Kudos
by Anonymous User
Not applicable

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/

 

0 Kudos
kusc3245
New Contributor II

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. 

0 Kudos
kusc3245
New Contributor II

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

 

kusc3245_0-1617690087152.png

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. 

 

0 Kudos