Hi all,
I am trying to pull a layer hosted by the nasa mapserver into my arcgis js api app. The layer is here:
https://maps.disasters.nasa.gov/ags04/rest/services/ca_fires_202008/sentinel2/MapServer
I define the layer like this:
export const SC2Sept29 = new MapImageLayer({
url:
'https://maps.disasters.nasa.gov/ags04/rest/services/ca_fires_202008/sentinel2/MapServer/547',
}); And add it to the map. This is giving me a 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 'http://localhost:5501' 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've done a lot of reading about CORS issues, and configuring a proxy, but I'm struggling to pull this layer in. I am not having issues with my other layers, most of which are coming directly from arcgis's own servers. When I check the response headers for this request, there are no "Access-Control-Allow-<X>" headers. Does this mean that this is an older server that is not configured for CORS?
I registered my application and tried to establish a proxy for it , and then use esriConfig to configure my app to use it. When I do that, the page make a request without the proxy, which throws the CORS error. But then it makes the request again with the proxied URL:
https://utility.arcgis.com/usrsvcs/appservices/LmNXFvAttVIu5FBo/rest/services/World/Utilities/GPServer/GetToolInfo/execute?https://maps.disasters.nasa.gov/ags04/rest/services/ca_fires_202008/sentinel2/MapServer/547?f=json
But I'm getting a 403:forbidden error on that request. Though I may not have configured my proxy correctly in my app. Configuring a proxy requires that you select a service, like "Geocoding," "Routing Utilities," etc. I tried "Routing Utilites," and "Service Area," but I'm sort of stumbling in the dark.
I'm not sure if I'm going about this all wrong. How can I get these NASA layers in my app? I was under the assumption that NASA's layers are available for public consumption. Is that incorrect?
Thanks for reading