XMLHttpRequest bas been blocked by CORS policy.

904
1
07-04-2023 09:34 AM
Vara_PrasadM_S
Occasional Contributor II

Hi All,

I request help in solving below error while trying to upload a shapefile using REST API - addItem, to out ArcGIS Online account.

 

Error Message:

Access to XMLHttpRequest at 'https://xxx.arcgis.com/sharing/rest/content/users/user/addItem' from origin 'https://localhost' has been blocked by CORS policy: Request header field x-requested-with is not allowed by Access-Control-Allow-Headers in preflight response.

Tags (1)
0 Kudos
1 Reply
AndyGup
Esri Regular Contributor

Hi @Vara_PrasadM_S that is a common error and it means your app or an intermediary app, such as a proxy, is modifying an HTTP header field. This isn't an issue with the ArcGIS JS SDK. You'll need to examine your network requests, and there are plenty of resource on the web providing information on how to narrow down what's causing the problem and fix it.

0 Kudos