I am trying to bring an ImageMapLayer into an ArcGIS JS API project. The layer is here:


I am creating the layer like this:

export const SC2Sept29 = new MapImageLayer({

When adding it to the map, I get the classic cors error:

Access to fetch at 'https://maps.disasters.nasa.gov/ags04/rest/services/ca_fires_202008/sentinel2/MapServer/547
?f=json' from origin 'https://8080-ea244033-ed39-4cd4-86f7-6fb2cfbea40b.ws-us02.gitpod.io' 
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the 
requested resource. If an opaque response serves your needs, set the request's mode to 
'no-cors' to fetch the resource with CORS disabled.

I was under the impression that NASA's GIS/ESRI data is available for public use. Are their servers not configured for CORS? What am I missing here?

  • Seth, there's a problem with you code snippet: The MapImageLayer URL should end with "/MapServer". Not the ""/547" grouplayer. Dec 8, 2020 at 22:10
  • Thanks for the heads up. I was aware of that - I justed edited it out. That doesn't seem to have any effect on the CORS issue though. Dec 8, 2020 at 22:11

1 Answer 1

  1. Check into the webserver, if you are hosting a web application has CORS headers or not
  2. The parameter Allow Origin in the portal end Restrict cross-domain requests to your portal
  3. Check whether the webserver is been added as a Trusted Server in the application or not, Search for trustedservers in esri/config, and if it is not added, then the CORS issue might arise, giving the error: No-Access-Control-Allow-Origin
  • Thanks for this info...would you mind elaborating a bit? I am not in control of the server/portal serving the layer, that is NASA's. As far as my app, its a static web page app, pretty simple. The CORS error I posted was from a webpack dev server spun up by gitpod, but I get the same error when using my local machine and localhost. I am not getting CORS errors with other layers from ArcGIS server in the same app. The app will end up hosted on github pages. Can you elaborate on how I can use esriConfig to modify the requests to automatically enable CORS? Nov 20, 2020 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.