4

I am getting the CORS error

  XMLHttpRequest cannot load http://services.arcgisonline.com/ArcGIS/rest/info?f=json. 
  No 'Access-Control-Allow-Origin' header is present on the requested resource. 
  Origin 'http://myserver.com' is therefore not allowed access.

when I use the ESRI topo base map in my ArcGIS JSAPI application. The application is hosted on IIS8 (Windows Server 2012 R2)

I am reading the ESRI ArcGIS API for JavaScript Samples CORS buffer There is a suggestion to add the root URL for CORS enabled servers to

esri.config.defaults.io.corsEnabledServers

Can you provide example how to do that?

I am not sure if the problem is on my server/application or the ESRI map server

4

You shouldn't worry about this error. The ESRI JSAPI is just testing whether the server at services.arcgisonline.com supports CORS.

It currently doesn't support CORS, and hence the JSAPI throws an error in the console. This error doesn't indicate any problem at all. Most of your users will never see this error, and you shouldn't worry about it.

If you are interested, here is a ArcGIS Idea, which you could vote up: http://services.arcgisonline.com should support CORS

  • So I guess I just need to set up correctly the proxy.config file. I would expect ESRI ArcGIS JSAPI to have to some fail check if the server supports CORS and fall back to proxy if it is not. Seeing the XMLHttpRequest error is annoying. – mitaka Feb 6 '14 at 15:40
  • You don't need the proxy if you are just using the base map from arcgis online. – Devdatta Tengshe Feb 6 '14 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.