Skip To Content

Use proxy

When you deploy an app, you may need to use a proxy. Web AppBuilder supports using proxies in the following situations:

  • Accessing cross domain resources
  • Requests that exceed 2048 characters
  • Access resources secured with token based authentication
  • OAuth 2.0 app logins.
  • Enables logging
  • Both resource and referer based rate limiting

By default, the downloaded app uses the proxy provided by Portal for ArcGIS. Specify your own proxy and rules by modifying the httpProxy property in the app's config file. The httpProxy contains the following attributes.

Attribute

Description

useProxy

Boolean. Optional. Default: true. If false, all requests will not use a proxy.

url

String. Optional. The URL to specify the proxy location. If the request doesn't match any proxy rule, but has to use proxy, such as a cross domain request, then this proxy will be used.

alwaysUseProxy

Boolean. Optional. Specifies whether or not the proxy should always be used for communication to a REST endpoint. Default: false. If the request doesn't match any proxy rule, and doesn't need a proxy, the application checks this property to decide how to further use the proxy. If false, the request does not go through the url referenced proxy. If true, the request goes through the url referenced proxy.

rules

Object[]. Optional. Defines the proxy for a set of resources with the same URL prefix. If the request URL matches a rule, the request routes through the proxy. Each rule has two properties:

  • urlPrefix-string. URL prefix for resources that need to be accessed through the given proxy.
  • proxyUrl-string. URL for the proxy.

The following demonstrates how proxies work in relation to the above attributes:

  • First, the app checks useProxy.
    • If false, all requests do not use a proxy.
    • If true, the app checks rules next.
      • If the request matches the proxy rules, the app uses the proxyUrl set in the rules.
      • If the request does not match any proxy rule, but has to use a proxy, such as a cross domain request, the app uses url referenced proxy.
      • If the request does not match the proxy rules nor requires a proxy, the app checks alwaysUseProxy further.
        • If false, the request does not go through the url referenced proxy.
        • If true, the request goes through the url referenced proxy.
Proxy diagram

Example:

"httpProxy": {
		"useProxy": true,
		"url": "http://gallery.chn.esri.com/arcgis/sharing/proxy",
		"alwaysUseProxy": false,
		"rules": [{
			"urlPrefix": "http://route.arcgis.com/",
			"proxyUrl": "resource-proxy-1.0/DotNet/proxy.ashx"
		}]
	}

In addition, Esri provides three proxies, each targeting a specific server-side platform: ASP.NET, Java/JSP, and PHP. Download and deploy the appropriate proxy for your platform from GitHub. Also, refer to Using the proxy page for details.