Using CORS Instead of Proxy Page to Query Services

3613
0
09-16-2014 03:19 AM
ShaunWeston1
New Contributor III

I've written some code in JavaScript to query the ArcGIS REST Admin API to query a lit of services on a different domain to where the application is hosted.

Basically the app will make a rest to a URL like this - http://SERVER:6080/arcgis/rest/services?token=IHFgoom_rq5DJ9lU5sXi2AWKRAuTsBMi8lhlYhdPjJI.

To get a list of services. The above works fine when I enable CORS like this beforehand:

        esri.config.defaults.io.alwaysUseProxy = false;

        esri.config.defaults.io.corsEnabledServers.push("SERVER:6080");

But as soon as I change the url to the REST Admin API instead of the REST services directory i.e. http://SERVER:6080/arcgis/admin/services?token=IHFgoom_rq5DJ9lU5sXi2AWKRAuTsBMi8lhlYhdPjJI. it doesn't work and I get this:

esri.config.defaults.io.proxyUrl is not set.

Even though I've got CORS setup, so does anyone know why the ArcGIS REST services directory is different to the admin API directory when using CORS?

Tags (3)
0 Kudos
0 Replies