No 'Access-Control-Allow-Origin' HELP!!

26004
20
Jump to solution
11-02-2017 09:32 AM
Occasional Contributor III

I've been dealing with this issue for a while. I have a geoprocessing tool on the ArcGIS server that generates a report from a map click. I get the CORS error when the server tries to return the report PDF to the popup in the map window. 

I've tried adding this to our webconfig file, and it doesn't help. 

<customHeaders>  
                    <add name="Access-Control-Allow-Origin" value="*" /> 
                    <add name="Access-Control-Allow-Headers" value="*" /> 
                    <add name="Access-Control-Allow-Methods" value="*" /> 
               </customHeaders>‍‍‍‍‍‍‍‍‍‍

I tried adding this to my JavaScript code and it worked in once instance, but not another. 

esriConfig.defaults.io.corsEnabledServers.push("ourserver.com")

I've also tried removing these lines from the webconfig and adding "Access-Control-Allow-Origin, * " under HTTP response headers in our IIS web server manager and I get this error "The 'Access-Control-Allow-Origin' header contains multiple values 'null, *', but only one is allowed. Origin 'null' is therefore not allowed access."

I'm pulling my hair out trying figure this out. 

Tags (1)
20 Replies
New Contributor II

Not sure if this is helpful, but I was getting a similar error recently and solved it with esri.config in the javascript. 

require(["esri/config], function(esriConfig){

esriConfig.defaults.io.corsDetection = false

...

Reply
0 Kudos