Select to view content in your preferred language

Proxied MapImageLayer fails to load Sublayer details

185
1
3 weeks ago
SebastianFrey1
New Contributor II

I have a Single Page Application (SPA), which is accessible under

http://localhost:8080/ 

In addition I have a MapServer hosted on a local arcgis server instance with the following URL

http://localhost:6443/arcgis/rest/services/myservice/MapServer 

Due to authentication in production, this MapServer must be proxied through my backend , which handles authentication against the ArcGIS server services. So the service is accessible through the following URL

http://localhost:8080/proxy/myservice

Now in that SPA, I create a MapImageLayer instance using the proxy URL:

import MapImageLayer from "@arcgis/core/layers/MapImageLayer.js";

const layer = new MapImageLayer({
  url: 'http://localhost:8080/proxy/myservice'
});
await layer.load();

const sublayer = layer.sublayers.at(0);
await sublayer.load();

 

At first everything seems fine, because

assert(sublayer.loadStatus === 'loaded')

 

does not fail, but members like fields, renderer or labeling info are not populated properly.

 

So I took a look at my browsers network log, which logs a 404 request to

http://localhost:8080/layers?f=json 

I assume that this request should fetch the Sublayer details, such as fields, renderer or labeling info. But instead of instantiating the request relative to the SPA's root, the Sublayer details should be fetched relative to the layer proxy URL:

http://localhost:8080/proxy/myservice/layers?f=json

 

Is this actually a bug in the SDK, or something I can fix on my side?

Tags (3)
0 Kudos
1 Reply
SebastianFrey1
New Contributor II
0 Kudos