Select to view content in your preferred language

Access-Control-Allow-Origin

7373
5
Jump to solution
08-28-2012 06:37 AM
evanpicard
Emerging Contributor
[HTML]
XMLHttpRequest cannot load http://server.arcgisonline.com/ArcGIS/rest/info?f=json. Origin http://<myserverIP> is not allowed by Access-Control-Allow-Origin.
[/HTML]

I get this in the console.
I've added

<system.webServer>    <httpProtocol>      <customHeaders>        <add name="Access-Control-Allow-Origin" value="*" />      </customHeaders>    </httpProtocol>  </system.webServer>

to C:\inetpub\wwwroot\ArcGIS\rest\Web.Config
and restarted server, as instructed by http://enable-cors.org/ and http://alpascual.com/post/2011/06/08/Enabling-Cross-Origin-Resources-in-IIS-7.aspx

I still get the same error.

AGS server 10.0 JSAPI 3.1
Help?
0 Kudos
1 Solution

Accepted Solutions
5 Replies
DavideLimosani
Frequent Contributor
0 Kudos
evanpicard
Emerging Contributor
0 Kudos
demdeberanz
Emerging Contributor
Hi guys,
    I'm experiencing a similar issue. I get a strange behavior, sometimes the browser is able to download the api from a different server than the one on which the web application is hosted,  on the contrary sometimes happen that it gets only some pieces of the  api (always from a different server then the web application) and the application doesn't work, I get the following message "Could not load cross-domain resources".

Can someone help me?

Thank you very much.
0 Kudos
ConnieLeung
Occasional Contributor
I am able to get away with the allow-control-allow-origin error by following this thread
http://alpascual.com/post/2011/06/08/Enabling-Cross-Origin-Resources-in-IIS-7.aspx

For JavaScript and CSS3 to access your website resources without having to post using proxies, CSS3 is now here to help. On your web application add on your web.config under system.webServer and all response to javascript will include that letting JavaScript know that is ok to post without the limitation and without using a proxy.

<system.webServer>
   <httpProtocol>
     <customHeaders>
       <add name="Access-Control-Allow-Origin" value="*" />
     </customHeaders>
   </httpProtocol>
</system.webServer>

In ArcGIS 10 you can enable that by adding it to the web.config found at c:\inetpub\wwwroot\ArcGIS\rest\web.config
0 Kudos
KaiB_
by
Occasional Contributor
One more hint, I had no luck with Firefox 24, but in Chrome 30 it worked, please have a look to the browser-possibilites in http://caniuse.com/cors
0 Kudos