Set Up a Proxy Page for the HTML5 Viewer
There are two reasons why you might use a proxy page with the HTML5 Viewer:
-
To enable cross-origin access to resources such as workflows or a geometry service.
For accessing resources such as workflows and geometry services, using a proxy page is an alternative to cross-origin resource sharing (CORS).
To enable cross-origin access when the viewer is deployed to a different domain than Essentials, use cross-origin resource sharing. For more information, see Set Up Cross-Origin Resource Sharing (CORS).
-
To allow large requests.
Proxies permit large requests to be posted using HTTP POST, which avoids the size limitation on HTTP GET operations. This can be useful for editing and query operations, which can involve large requests.
The HTML5 Viewer installation package includes proxy pages for ASP.NET, Java (JSP), and PHP. These proxy pages are based on the ones that Esri provides for the ArcGIS API for JavaScript. For more information, refer to Using the Proxy in Esri's ArcGIS API for JavaScript documentation.
Use the ASP.NET Proxy Page that Ships with the Viewer
To configure the ASP.NET proxy page to work with your HTML5 viewers:
These instructions assume that you deployed the HTML5 Viewer template to IIS.
-
If ASP.NET 2.0 or newer is not installed on the server where the Geocortex Viewer for HTML5 is deployed, install it now and register it with IIS.
The ASP.NET proxy page requires ASP.NET 2.0 or newer.
-
If you want to deploy the proxy page to a custom location:
-
Move or copy the
proxy.ashx
andproxy.config
files to the desired location.By default,
proxy.ashx
andproxy.config
are in the folder where you deployed the Geocortex Viewer for HTML5. The location that you copy the proxy files to must be known to your web server. -
In IIS Manager, convert the folder containing
proxy.ashx
andproxy.config
to an application that uses a .NET 2.0 or newer application pool. -
For each HTML5 viewer that you have added to a site, configure the proxy's URI using one of the following methods:
-
In Manager, edit the viewer. In the side panel, click Application. In the Proxy URI box, type the location of your proxy. Click Apply Changes and Save Site.
-
Alternatively, open the viewer's three configuration files in a text editor and update each file's
proxyUri
element to point to the proxy location.
-
-
-
Run a text editor as an administrator and edit
proxy.config
.The
proxy.config
file is used to configure the ArcGIS Server services that the proxy will forward to. By default, theproxy.config
file is inC:\inetpub\wwwroot\Html5Viewer
. -
Add a
serverUrl
element for each of your servers.Alternatively, modify any of the default
server.url
elements that you do not need.You must have a
serverUrl
element for each geocoding service that you use. For information on configuring geocoding services, see Geocoding Services.The
serverUrl
element has the following attributes:-
url
: The location of the server. -
matchAll
: Set totrue
to forward every request that begins with theurl
. -
token
: (optional) The security token to include for a secured service. -
dynamicToken
: Set totrue
to get the token dynamically using the user name and password that are stored in theappSettings
section of the server'sweb.config
file.
By default, the
ProxyConfig
element'smustMatch
attribute is set totrue
. This prevents viewer access to any address that is not specified in theserverUrls
. -
-
Save the
proxy.config
file. -
If your site accesses services that are secured using Windows Authentication, follow the instructions in Adapt the ASP.NET Proxy Page to Access Windows-Secured Servers below.
Adapt the ASP.NET Proxy Page to Access Windows-Secured Servers
We recommend that you avoid securing your ArcGIS services with Basic Authentication because editing will not work
You must configure the proxy to access Windows-secured servers if either:
-
Your site contains ArcGIS services that are secured using Windows Authentication.
-
Your Essentials server is secured using Windows Authentication and either:
-
Your Essentials server is hosted on a different domain to the HTML5 Viewer.
-
You intend to use the Geocortex Mobile App Framework.
-
To adapt the ASP.NET proxy page to access Windows-secured servers:
Step 1: Configure authentication in IIS
-
In IIS Manager, expand the Connections panel's folders to show the location where you deployed the Viewer.
-
Click the Viewer. By default, its name is Html5Viewer.
The center panel shows the Features View.
-
In the IIS section, double-click Authentication .
The center panel shows the authentication settings.
-
Right-click ASP.NET Impersonation and select Enable.
Some versions of IIS call this option "Windows Impersonation" instead of "ASP .NET Impersonation". If your version of IIS does not have an ASP .NET Impersonation option, enable Windows Impersonation.
-
Right-click Windows Authentication and select Enable.
Do not close IIS Manager yet.
Step 2: Configure the proxy to forward the credentials
-
In IIS Manager, right-click the Viewer and click Explore.
Windows Explorer will open to the folder that contains the proxy page.
-
Open the
proxy.config
file in a text editor. -
Add a new
serverUrl
element. -
Add a
url
attribute to the newserverUrl
element and set the attribute to the URL of your Windows-secured server. -
Add a
matchAll
attribute to the newserverUrl
element and set it totrue
.The markup should look similar to the following, with
server.domain.com
replaced by your host name.-
Windows-secured ArcGIS Service:
<serverUrl url="http://server.domain.com/arcgis/rest/services/" matchAll="true"></serverUrl>
-
Windows-secured Essentials Server:
<serverUrl url="http://server.domain.com/geocortex/essentials" matchAll="true"></serverUrl>
If you are using Esri's proxy page instead of the one that ships with the HTML5 Viewer, you must add the Essentials server and set its
useAppPoolIdentity
attribute totrue
so that it looks similar to the following:<serverUrl url="http://server.domain.com/geocortex/essentials" matchAll="true" useAppPoolIdentity="true"></serverUrl>
To determine if you are using Esri's proxy page, search the
proxy.ashx
file foruseAppPoolIdentity
. -
-
Save the file and close the editor.
-
Close IIS Manager.