Select to view content in your preferred language

XMLHttpRequest cannot load....?

13410
5
Jump to solution
01-23-2014 08:06 AM
ionarawilson1
Deactivated User
Why am I getting this message in the browser developer when I run an application?

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://localhost' is therefore not allowed access.
1 Solution

Accepted Solutions
derekswingley1
Deactivated User
Why am I getting this message in the browser developer when I run an application?

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://localhost' is therefore not allowed access.


This happens because the server in question (services.arcgisonline.com) does not support CORS. This has been discussed quite a bit in these forums and the thread you linked (a previous post of mine) is relevant. More information here:  http://forums.arcgis.com/threads/94219-Disable-CORS-Discussion

You can ignore this error. If you want to make it go away, turn off CORS detection:
require(["esri/config"], function(esriConfig) {   esriConfig.defaults.io.corsDetection = false; });

View solution in original post

5 Replies
JonathanUihlein
Esri Regular Contributor
It looks like you may need to set up a proxy.
0 Kudos
ionarawilson1
Deactivated User
Hi Jon,

I added that line to my proxy page and I still have the issue, but just in Chrome, not in FF. Could it be that this is just a bug?

Here is another thread talking about it:

http://forums.arcgis.com/threads/60386-Access-Control-Allow-Origin-and-3.0?p=208466&viewfull=1#post2...

And here is the contents of my proxy. Am I doing something wrong or is this just something not to worry about like that other thread suggested? Thank  you!

[HTML]
<?xml version="1.0" encoding="utf-8" ?>
<!-- Proxy config is used to set the ArcGIS Server services that the proxy will forward to.
       
        mustMatch: true to only proxy to sites listed, false to proxy to any site -->
<ProxyConfig mustMatch="false">
  <serverUrls>
    <!-- serverUrl options:
            url = location of the ArcGIS Server, either specific URL or stem
            matchAll = true to forward any request beginning with the url
            token = (optional) token to include for secured service
            dynamicToken = if true, gets token dynamically with username and
              password stored in web.config file's appSettings section.
    <serverUrl url="http://services.arcgisonline.com/ArcGIS/services"
               matchAll="true"></serverUrl>
<serverUrl url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"
               matchAll="true"></serverUrl>
<serverUrl url="http://tfsgis-iisd01:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer"
               matchAll="true"></serverUrl>
<serverUrl url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0"
               matchAll="true"></serverUrl>
<serverUrl url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/1"
               matchAll="true"></serverUrl>
<serverUrl url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer"
               matchAll="true"></serverUrl>    
<serverUrl url="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%2..."
               matchAll="true"></serverUrl>
     
<serverUrl url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/FeatureServer/0"
               matchAll="true"></serverUrl>
    -->
    <serverUrl url="http://sampleserver1.arcgisonline.com/arcgis/rest/services/"
               matchAll="true"></serverUrl>
    <serverUrl url="http://sampleserver2.arcgisonline.com/arcgis/rest/services/"
               matchAll="true"
               token=""></serverUrl>
    <serverUrl url="http://server.arcgisonline.com/arcgis/rest/services/"
               matchAll="true"></serverUrl>
    <serverUrl url="http://orthogonal.esri.com/arcgis/rest/services/"
               matchAll="true"></serverUrl>
    <serverUrl url="http://hummer/ArcGIS/rest/services"
               matchAll="true"
               dynamicToken="true"></serverUrl>


<serverUrl url="http://tfsgis-iisd01:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer"
               matchAll="true"></serverUrl>         
  </serverUrls>
 
</ProxyConfig>

[/HTML]
0 Kudos
derekswingley1
Deactivated User
Why am I getting this message in the browser developer when I run an application?

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://localhost' is therefore not allowed access.


This happens because the server in question (services.arcgisonline.com) does not support CORS. This has been discussed quite a bit in these forums and the thread you linked (a previous post of mine) is relevant. More information here:  http://forums.arcgis.com/threads/94219-Disable-CORS-Discussion

You can ignore this error. If you want to make it go away, turn off CORS detection:
require(["esri/config"], function(esriConfig) {   esriConfig.defaults.io.corsDetection = false; });
ionarawilson1
Deactivated User
Thank you Derek! It is nice not to have that error anymore!
0 Kudos
PrithvirajShunmugham
Emerging Contributor

Hello @derekswingley1 , I'm new to esri community. Currently i developing the web app from webapp builder developer edition,I deployed and run through local machine, im facing the same error which has faced by @ionarawilson1. could you please help me out to solve this issue.

Below error screenshot which i currently facing  

PrithvirajShunmugham_0-1705559945198.png

 

0 Kudos