XMLHttpRequest cannot load http://ARGISserver/arcgis/rest/services/LIVEinternal/aerials/MapServer/legend?f=json. The 'Access-Control-Allow-Origin' whitelists only 'http://appURL'. Origin 'http://appURL_dev' is not in the list, and is therefore not allowed access. (index):1 k {stack: "Error: Unable to load http://ARGISserver/arcgis/rest???ev/arcgis_js_api/library/3.7/3.7/init.js:3570:29)", message: "Unable to load http://ARGISserver/arcgis/rest/servic???nternal/aerials/MapServer/legend?f=json status: 0", response: Object, status: 0, responseText: ""???}
<system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders> </httpProtocol> </system.webServer>
XMLHttpRequest cannot load http://my server name/arcgis/rest/info?f=json. The 'Access-Control-Allow-Origin' whitelists only 'http://myURL, *'. Origin 'http://myURL' is not in the list, and is therefore not allowed access.
bump - still getting this - anyone any ideas how to make it stop?
Adrian,
Have you considered just turning cors detection off? esri.config.defaults.io.corsDetection = false;
Not sure I know where to put that. However, I replaced the * in the
http://server/arcgis/admin/system/handlers/rest/servicesdirectory
With some random text and that sorted it. I think too many things were trying to do the same thing - I have really no idea what I am talking about.
Adrain,
That line would just go in your code before to initiate your map var
Brill - that worked as well - much better than playing with options I had no idea about, many thanks
Using Server Manager, in IIS, you can navigate to the site and under the HTTP Response Headers you can choose ADD, then title Access-Control-Allow-Origin and value is the IP or domain of the site you want to allow. Could always choose * for everyone.
While you can do it in your code, Server side is probably the best option.