AnsweredAssumed Answered

Handling CORS issue while using GeoJSON layer URL

Question asked by george.abraham1912 on Jul 18, 2019
Latest reply on Jul 22, 2019 by george.abraham1912

To test an application, I created a sample GeoJSON on my AWS and passing its URL to the GeoJSON Layer JS API to access it - however I am facing CORS issue.

 

For now I am able to bypass it with disabling Chrome security, however, I wanted to know if there is any means to pass appropriate Request headers to fix this for final.

 

I tried:

var options = {
query: {
f: "json"
},
responseType: "json",
mode: "no-cors"
};

 

and also

 

var options = {
query: {
f: "json"
},
responseType: "json",
headers: {
"Access-Control-Allow-Headers": "*"
}
};

 

when I am using require(["esri/request"] but to no success - its still throwing the same error. What am I missing here?

Outcomes