require(["esri/config"], function(esriConfig) { /* code goes here */ });
Object: esri/config
Since: ArcGIS API for JavaScript 4.0

Configure global properties of the library.

The value of this module is an object with the following properties.

Example:
require(["esri/config"], function(esriConfig) {
  esriConfig.request.proxyUrl = "/resource-proxy/Java/proxy.jsp";
});

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryObject
String

The default GeometryService used by widgets and other operations, such as on-the-fly projections.

more details
more detailsconfig
String

The URL for the utility service used by GeoRSSLayer to convert GeoRSS documents.

more details
more detailsconfig
String

The URL for the utility service used by KMLLayer to convert KML documents.

more details
more detailsconfig
String

The URL of the portal instance.

more details
more detailsconfig
Object

An object with properties that control various aspects of communication between the library and web servers.

more details
more detailsconfig
Object

The AMD loader's configuration object, which is loaded with each worker.

more details
more detailsconfig

Property Details

geometryServiceUrlString

The default GeometryService used by widgets and other operations, such as on-the-fly projections.

Default Value: "https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer"
Example:
esriConfig.geometryServiceUrl = "https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer";

geoRSSServiceUrlString

The URL for the utility service used by GeoRSSLayer to convert GeoRSS documents.

Default Value: "https://utility.arcgis.com/sharing/rss"
Example:
esriConfig.geoRSSServiceUrl = "http://servername.domain.suffix/arcgis/sharing/rss";

kmlServiceUrlString

Since: ArcGIS API for JavaScript 4.5

The URL for the utility service used by KMLLayer to convert KML documents.

Default Value: "https://utility.arcgis.com/sharing/kml"
Example:
esriConfig.kmlServiceUrl = "http://servername.domain.suffix/arcgis/sharing/kml";

portalUrlString

The URL of the portal instance. If using an on-premise portal, this value should be set to the portal instance, for example: https://www.example.com/arcgis

Default Value: "https://www.arcgis.com"
See also:
Example:
// Set the hostname to the on-premise portal
esriConfig.portalUrl = "https://myHostName.esri.com/arcgis"

requestObject

An object with properties that control various aspects of communication between the library and web servers.

Properties:
corsDetection Boolean
optional

Indicates whether the library automatically detects if CORS (Cross-Origin Resource Sharing) specification is supported by ArcGIS Servers used in your application.

Upon successful detection, the server will be added to corsEnabledServers list. CORS detection will not be performed for a server if it is already listed in corsEnabledServers.

Default value:

true if your application is running in a web browser.

false if your application is running on Apache Cordova platform.

corsDetectionTimeout Number
optional

Number of seconds to wait for response from the ArcGIS Server during CORS detection. If the detection is not complete before this time expires, then it is assumed that the server does not support CORS.

Default value: 15

Applicable when corsDetection is true.

corsEnabledServers String[]|Object[]
optional

A list of servers known to support CORS specification.

Out of the box, this list includes many Esri hosted servers that are known to support CORS and is updated at every release as the list grows. The library is capable of automatically detecting CORS support for servers used in an application (see corsDetection), but if you are already aware that a server supports CORS, then it should be added to this list. Since the API includes some servers by default it's important to add items onto this array rather than overwriting it.

The following servers are enabled by default:

  • basemaps.arcgis.com (added in 4.3)
  • demographics1.arcgis.com (added in 4.4)
  • demographics2.arcgis.com (added in 4.4)
  • demographics3.arcgis.com (added in 4.4)
  • demographics4.arcgis.com (added in 4.4)
  • demographics5.arcgis.com (added in 4.4)
  • demographics6.arcgis.com (added in 4.4)
  • elevation3d.arcgis.com
  • geocode.arcgis.com
  • geoenrich.arcgis.com
  • js.arcgis.com
  • server.arcgisonline.com
  • services.arcgis.com
  • services.arcgisonline.com
  • services1.arcgis.com
  • services2.arcgis.com
  • services3.arcgis.com
  • services4.arcgis.com
  • services5.arcgis.com
  • services6.arcgis.com
  • services7.arcgis.com
  • services8.arcgis.com
  • services9.arcgis.com
  • static.arcgis.com
  • tiles.arcgis.com
  • tiles1.arcgis.com
  • tiles2.arcgis.com
  • tiles3.arcgis.com
  • tiles4.arcgis.com
  • utility.arcgis.com (added in 4.4)
  • utility.arcgisonline.com
  • www.arcgis.com

Example:

// Add a known server to the list.
require(["esri/config"], function(esriConfig) {
  esriConfig.request.corsEnabledServers.push("<hostname>.<domain>:<port>");
});

You can also pass objects to this property with the following specification:

Specification:
host String
optional

The host name of the server to add to the list of CORS-enabled servers.

withCredentials Boolean
optional

Indicates whether requests made to the associated server should include credentials such as cookies and authorization headers. Default is false.

forceProxy Boolean
optional

Indicates whether the proxy specified in proxyUrl is used for all AJAX requests made using request and images added using <img> element.

Default value: false

httpsDomains String[]
optional

List of domain suffixes known to support https. This will automatically upgrade requests made to such domains to use https instead of http when the application is not running on http. Note that port numbers should not be included in the domain suffix to be matched.

If no httpsDomains list exists , the API redirects all calls using https. If the list exists and a domain of a required http resource is not listed, the API sends the URL as it is specified within the code. Likewise, if the list exists and the domain of a required http resource is listed in it, the API sends an https request to that resource.

The list includes the following domain suffixes by default:

  • arcgis.com
  • arcgisonline.com
maxUrlLength Number
optional

Maximum number of characters allowed in the URL for HTTP GET requests made by request. If this limit is exceeded, HTTP POST method will be used.

Default value: 2000

proxyUrl String
optional

Resource proxy for your application. It is used by the library when communicating with a web server hosted on a domain that is different from the domain where your application is hosted.

The library may or may not use the proxy depending on the type of request made, whether the server support CORS, whether the application is being run on older versions of browsers etc. To keep it simple, it is recommended that you always configure a resource proxy for your application.

You can download the resource proxy from this GitHub repo.

Default value: null

require(["esri/config"], function(esriConfig) {
  esriConfig.request.proxyUrl = "/resource-proxy/Java/proxy.jsp";
});
timeout Number
optional

Number of milliseconds request will wait for response from a server. If a server fails to respond before this time expires, then the request is considered to have encountered an error.

Default value: 60000 (one minute)

useCors String | Boolean
optional

Indicates whether the library will use CORS-enabled requests when communicating with a web server hosted on a domain that is different from the domain where the application is hosted. If true, AJAX requests are directly made to servers that support CORS. If with-credentials is specified, then AJAX requests will use credentials stored in a client's cookies. If false, direct requests are not made. A proxy will be used if available.

Default Value: with-credentials

useIdentity Boolean
optional

Since: 4.5
Indicates whether esri/request will request a credential from IdentityManager.

Default value: true

proxyRules Object[]
optional

A proxy rule defines a proxy for a set of resources with an identical URL prefix. When using esriRequest, if a target URL matches a rule, then the request will be sent to the specified proxy. Rather than populating this array directly, use the urlUtils.addProxyRule() method. Rule objects have the following properties:

Specification:
proxyUrl String
optional

The URL of the proxy.

urlPrefix String
optional

URL prefix for resources that need to be accessed through a specific proxy.

workersObject

The AMD loader's configuration object, which is loaded with each worker. Modify the configuration to specify locations of packages to be loaded with the workers framework or to define a feature detection.

Properties:
loaderConfig Object
optional

The configuration parameters for the workers framework.

Specification:
has Object
optional

Determines if the specified feature capabilities are supported.

paths Object
optional

Map of module id fragments to file paths.

map Object
optional

Map paths in module identifiers to different paths.

packages Object[]
optional

An array of objects which provide the package name and its location.

Example:
esriConfig.workers.loaderConfig = {
 paths: {
   workerScripts: window.location.href.replace(/\/[^/]+$/, "/workerScripts"),
   dojo: "https://ajax.googleapis.com/ajax/libs/dojo/1.11.2/dojo/"
 },
 has: {
   "dojo-debug-messages": true
 }
};

// load workerScripts/Calculator.js in the workers framework
// and invoke its "getMaxNumber" method
workers.open(this, "workerScripts/Calculator")
  .then(function(connection) {
    return connection.invoke("getMaxNumber", {
     numbers: [0, 1, 2, 3, 4]
    });
  })
  .then(function(result) {
    console.log(result);
  });

//*********************************************************
// module: workerScripts/Calculator.js
//*********************************************************
define([
 "esri/core/promiseUtils"
],
 function (promiseUtils) {
   return {
     // this function can be invoked from the main thread
     getMaxNumber: function (data) {
       return promiseUtils.resolve({
         data: Math.max.apply(null, data.numbers)
       });
     }
   }
});

API Reference search results

NameTypeModule

There were no match results from your search criteria.