I am trying to show maps that are loaded from ArcGIS Server that we locally host, and I keep having trouble with (CORS).
I have to mention that when I launch the program within the WebStorm, it works just fine and everything loads with no problem. But when I copy the files on the webserver, and having IIS deliver the pages I keep getting the following error:
Image from origin 'AddressRemoved' has been blocked from loading by Cross-Origin Resource Sharing policy: The 'Access-Control-Allow-Origin' header has a value 'http://localhost:63342' that is not equal to the supplied origin. Origin 'http://localhost' is therefore not allowed access.
* I change the first address to to "AddressRemoved
I have provided a web.config file with the following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="Access-Control-Allow-Origin" />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
The above line is supposed to fix this problem but some how it is not. Any help or idea?
I had same issue but in my case google images were causing and i changed them to my domain.
From <Icon> <href>http://maps.google.com/mapfiles/kml/shapes/shaded_dot.png</href>
</Icon>
to
<Icon> <href>http://mydomain.com/myfiles/kml/shapes/shaded_dot.png</href> </Icon>
It worked for me.
Thanks
However, it is not possible for me to move the data to the same server. The web server are hosted on one machine, and the data are coming from ESRI ArcGIS server located on another server. So, it is not possible to move them on a single machine.
I noticed that this problem only exists on Google Chrome running on windows. IE and Firefox are just fine, and Google Chrome on Mac also does not have any problem.
Also, when I am locally testing the software running WebStorm, it runs just fine on google chrome on windows too.
I am just saying ....
Thanks
--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
So, This is the line I request data
var loadedLayer=new Cesium.ArcGisMapServerImageryProvider({
url : myGVars.mapServiceURL,
layers: layer2Load.toString()
});
myGVars stores all the global vars and mapServiceURL is the URL to the specific data set hosted on ESRI ArcGIS server on another machine with different address (using port 6080 to deliver).
When I get the CORS error, it is said to be on index.html:1 but then it is followed by couple of following error:
An error occurred in "": Failed to obtain image tile X: 3 Y: 0 Level: 2. Cesium.js:422
(the X,Y, and level changes, of courses).
Well, so CORS blocks data from loading and then Cesium produces those error.
So, the configuration that I posted above had fixed the solution, i.e. <add name="Access-Control-Allow-Origin" value="*" />.
All I needed was to clear the cache of Google Chrome.