Book Image

Mastering ArcGIS Server Development with JavaScript

By : Raymond Kenneth Doman
Book Image

Mastering ArcGIS Server Development with JavaScript

By: Raymond Kenneth Doman

Overview of this book

Table of Contents (18 chapters)
Mastering ArcGIS Server Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

A note on proxies


If you've worked with the ArcGIS JavaScript API for any length of time, or had to support older browsers like Internet Explorer 9 or less, then you've probably come across proxies. Proxies are server-side applications that make web requests on behalf of the web browser, often transmitting and receiving data the browser could not collect on its own. There are three primary reasons why a browser would require a proxy to communicate with a server. They are as follows:

  1. The browser is an older browser that does not support Cross Origin Resource Sharing (CORS), and the server requests will be made to a different server from the one the application sits on.

  2. The proxy provides additional security keys to access specific data, which might include secured tokens the developer doesn't want to release to the public.

  3. The web request is much longer than the 2048+ character maximum for GET requests.

The first example is common with older browsers, including Internet Explorer 9 or lower. They can't grab data from third party servers that are separate from the web server, because of a security restraint. With the HTML5 specification for CORS, newer browsers can check to see if an application is allowed to be requested from a script not on the server.

The second example is common in large secure environments, with many security hoops to jump through. Department portal websites could access proxies with tokens unique to the department, providing an extra layer of security.

The third example is common when the user is passing large geometries with many irregular vertices. For instance, if you were to use a drawing tool to draw an irregular shape with the free-handed drawer, its vertices are added as you move around on the map. With so many points, and those points requiring a lot of characters to show their latitude and longitude, it's no wonder a shape request might exceed the browser's maximum character length.

The ArcGIS Server proxy is free to download from GitHub (https://github.com/Esri/resource-proxy). They have versions that work with Java, .NET, and PHP. Please use the most recent version, and make sure it's properly configured for all the services you'll be using.

Tip

If both your computer and your ArcGIS Server are behind a network firewall, and the ArcGIS Server has unique public and private IP addresses, your network firewall may block proxy connections to your ArcGIS Server. If you see network traffic failing only on older browsers, such as Internet Explorer 8, and only for internal requests, the firewall might be the issue. Contact your network administrator to work out the issue.