How to ensure that urlUtils is executed before loading the layer?
urlUtils.addProxyRule({
urlPrefix: "XXXXXXX/server/rest/services",
proxyUrl: "https://XXXXXX/proxy.ashx"
});
const MAP = new MapImageLayer({
url: "https://XXXXXX/MapServer",
title: "XXXXXX",
spatialReference: {
wkid: 3826
},
visible: false,
listMode: "hide-children"
});
You could try using a RequestInterceptor to ensure that the layer uses the proxy URL:
https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#RequestInterceptor
Hi @Noah-Sager
When I use proxy, my printing function seems to be unable to print private layers.
Is there a solution to this problem?
error:
code: 400
details: ['Error executing tool. Export Web Map Task : error …eb Map).\nFailed to execute (Export Web Map Task).']
extendedCode: -2147467261
message: "Unable to complete operation."
@Wade - couple things to consider here.
1. are you sure all the relevant requests are going through the proxy?
2. do you have to use a proxy? we do have other workflows for security: https://developers.arcgis.com/javascript/latest/secure-resources/
3. in the webmap_as_json sent to the print service, do you see any token or anything being passed in the request?
@Noah-Sager
Yes, because a proxy is currently required to connect to ArcGIS Server, but printing problems may occur when using the proxy program.When using proxy, my layers are all private. In theory, I should directly bring in the proxy.config rules and log in to use the layer.
The current test results show that as long as proxy is used, it seems that the private layer cannot be used normally in printing.
Currently no similar examples can be found in arcgis document,Is there a solution to this?