No 'Access-Control-Allow-Origin' header is present on the requested resource

2 weeks ago
New Contributor

In my html page I have the following script to pull the base map from ESRI Online. This page is hosted on a web server locally. I am getting the following error how. Could people help me address this issue? Thank you


Access to XMLHttpRequest at '' from origin 'http://...' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.


Javascript in the HTML file:

var map;





], function(
parser, ready, arrayUtils, Color, domStyle, query,
Map, esriRequest, Graphic, Extent,
SimpleMarkerSymbol, SimpleFillSymbol, PictureMarkerSymbol, ClassBreaksRenderer,
ArcGISDynamicMapServiceLayer, ImageParameters, GraphicsLayer, SpatialReference, InfoTemplate, Point, webMercatorUtils,
AssetClusterLayer, dom, BasemapToggle, HomeButton
) {
ready(function() {

0 Kudos
6 Replies
Occasional Contributor II


I am not sure but try using proxy,for same error when using WMS it works , try in tis case too.

0 Kudos
New Contributor

how to use proxy in this case? require(["esri/map",...   not sure how to add a proxy in between yet.

0 Kudos
Esri Contributor

Hi @billzhang,

To support CORS, your web servers must be pre-configured for it and browsers must be able to support it. Sounds like the local web server mahy need to have CORS enabled. For additional details on enabling this in a web server, please visit

For more information about the API and CORS, see the following documentation: 

0 Kudos
New Contributor

trying to reach

The web server side to be configured is the arcgisonline side right? 

0 Kudos
Occasional Contributor III

Maybe try using "https" in the URL instead of "http"...

0 Kudos
New Contributor

I am using require(["esri/map",...   not sure how to use https for the esri online URL. any thoughts?

0 Kudos