HOW TO

Set up a reverse proxy for an installed ArcGIS Survey123 website

Last Published: April 17, 2023

Summary

This article is for users who have already installed and configured the Survey123 website in their environment. The Survey123 website installer can be downloaded from the My Esri website for Windows and Linux operating systems. Details for running and configuring the installation can be found in the following article: How To: Install and configure the ArcGIS Survey123 website.

The Survey123 website installer requires administrators to specify HTTP or HTTPS ports when configuring the package on the local infrastructure. By default, the Survey123 website is accessible on HTTP (5080) or HTTPS (5443) port. However, some users require a way to access the website using normal HTTP (80) or HTTPS (443) port. While this can be done by using ArcGIS Web Adaptor for portal or server in ArcGIS Enterprise, the Survey123 website installer relies on a reverse proxy to accomplish this. A reverse proxy is the generic procedure that allows a website to be accessible via a different port or server.

This article describes the steps to set up a reverse proxy for an installed ArcGIS Survey123 website, please refer to the section below for your operating system.

Procedure

Warning:   
Consult with the system administrator to see if this approach is suitable for your environment.

Windows:
Requirements

  • A web server running IIS. Ideally, this is the same web server that the ArcGIS Web Adaptors have been installed on - this provides the advantage of not needing to worry about cross-origin resource sharing with the Enterprise installation. Note: You must have administrative access on this web server.
  • Install the IIS URL Rewrite module. Ensure that the IIS URL Rewrite module is installed on your web server.
  • Install the IIS Application Request Routing module. Also ensure the IIS Application Request Routing module is installed on the web server. Once installed, enable proxy functionality as it is disabled by default:
  1. Open IIS Manager on the web server,
  2. Select your server from the tree view on the left.
  3. Double-click Application Request Routing.
  4. Select Server Proxy Settings from the Actions window on the right.
  5. Check the Enable Proxy checkbox, and click Apply.

Procedure

  1. Open IIS Manager on the web server.
  2. Expand the Sites entry in the left sidebar and select the site to access Survey123 from; in many cases, this is the Default Web Site. Right-click the site and select Explore.
  3. Create a new folder and rename it survey123. This folder is the access point for Survey123.
  4. Download web.config.zip, extract the web.config file, and copy it into this new folder. You can choose an alternative name for this folder, but just remember to update the value in the web.config file by editing it in a text editor, as shown in the following example:
<outboundRules>
  <rule name="update base tag" preCondition="isHTML">
    <match filterByTags="Base" pattern="^/(.*)" />
    <action type="Rewrite" value="/survey123/" />
    <conditions trackAllCaptures="false">
      <add input="{URL}" pattern="/" />
    </conditions>
  </rule>
  <preConditions>
    <preCondition name="isHTML">
      <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
    </preCondition>
  </preConditions>
</outboundRules>
  1. If the Survey123 website is not installed on the machine on which the reverse proxy is configured (or the HTTP port for Survey123 website is changed), update the server name in the inbound rules section of the web.config file. Otherwise, leave the URL as: http://localhost:5080/, as in the following example.
<rules>
  <clear />
    <rule name="ReverseProxyHTML" stopProcessing="false">
      <match url="(^$|.*\.html$)" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
      <action type="Rewrite" url="http://localhost:5080/{R:1}" />
      <serverVariables>
        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
        <set name="HTTP_ACCEPT_ENCODING" value="" />
      </serverVariables>
    </rule>
    <rule name="ReverseProxyInboundRule1" stopProcessing="true">
      <match url="(.*)" />
        <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
        <action type="Rewrite" url="http://localhost:5080/{R:1}" />
    </rule>
</rules>
  1. In IIS Manager, right-click the site and click Refresh to show the new folder.
  2. Select the folder.
  3. In the IIS section of the configuration properties, double-click URL Rewrite.
  4. In the URL Rewrite Actions pane, click View Server Variables.
  5. Click Add under the Actions panel on the right and add three variables:
    • HTTP_ACCEPT_ENCODING (this appears in the drop-down list)
    • HTTP_X_ORIGINAL_ACCEPT_ENCODING
    • HTTP_X_ORIGINAL_HOST
  6. Click Back to Rules.
  7. Access the installed Survey123 website using the base URL and reverse proxy point.

Linux
Requirements:
Given there are numerous Linux distributions, the process for configuring a reverse proxy differs slightly from one to another. These instructions are a basic 'minimum' to access the installed Survey123 website via reverse proxy, and covers the three Linux distributions supported by ArcGIS Enterprise 10.9.1 : Red Hat Enterprise Linux (RHEL) Server, SUSE Linux Enterprise Server (SLES) and Ubuntu Server.

  • A web server running Apache. Ideally, this is the same web server as your ArcGIS Web Adaptors are installed on - this provides the advantage of not needing to worry about cross-origin resource sharing with the Enterprise installation.  Note: You must have administrative access on this web server.
  • Have Apache configured with SSL. This is optional but very highly recommended.

Procedure

  1. *RHEL only - Check if the httpd service can create network connections:
sudo getsebool httpd_can_network_connect
  • If  it's turned off, run:
sudo /usr/sbin/setsebool -P httpd_can_network_connect 1
  1. Load the required modules.

RHEL - create a configuration file to load modules:

sudo vim /etc/httpd/conf.modules.d/00-survey123.conf
  • Copy / paste the following into the file:
# This file configures all the modules needed for the Survey123 website:
LoadModule proxy_module modules/mod_proxy.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule filter_module modules/mod_filter.so
LoadModule substitute_module modules/mod_substitute.so

SLES / Ubuntu - enable the modules individually using:

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod filter
sudo a2enmod substitute
  1. Create / Edit your Survey123 site configuration file(s) to contain the reverse proxy directives.
RHEL  - example:
sudo vim /etc/httpd/conf.d/survey123.conf

SLES  - example:

sudo vim /etc/apache2/vhosts.d/survey123.conf
sudo vim /etc/apache2/vhosts.d/survey123-ssl.conf
Ubuntu - example using the default site configuration files:
sudo vim /etc/apache2/sites-available/000-default.conf
sudo vim /etc/apache2/sites-available/default-ssl.conf
  1. Copy / paste the following reverse proxy directives into the file (remember to comment out section A or B depending on whether you’re using HTTP or SSL):
# ------------------------------------
# Survey123 reverse proxy configuration
# Enable ProxyPreserveHost - useful for application logging
ProxyPreserveHost On
# ------------------------------------
# Configure the reverse proxy.  Use either A. or B.
# ------------------------------------
# A. Reverse proxy over HTTP
ProxyPass /survey123 http://localhost:5080
ProxyPassReverse /survey123 http://localhost:5080
RequestHeader add X-ORIGINAL-URI "expr=%{HTTP_HOST}%{REQUEST_URI}"

# B. Reverse proxy over SSL: 
# SSLProxyEngine on
# These SSLProxy statements may be needed if Survey123 is using an untrusted certificate
# SSLProxyVerify none
# SSLProxyCheckPeerName off
# SSLProxyCheckPeerCN off
# SSLProxyCheckPeerExpire off
# ProxyPass /survey123 https://localhost:5443
# ProxyPassReverse /survey123 https://localhost:5443
# RequestHeader add X-ORIGINAL-URI "expr=%{HTTP_HOST}%{REQUEST_URI}"
# ------------------------------------
# Filter & update the <base> tag in HTML
<Location "/survey123">
              AddOutputFilterByType INFLATE;SUBSTITUTE;DEFLATE; text/html text/plain text/xml
               Substitute 's#"/"#"/survey123/"#ni'
</Location>
# End Survey123 reverse proxy configuration
# ------------------------------------
  1. Restart Apache.

RHEL

sudo systemctl restart httpd

SLES / Ubuntu

sudo systemctl restart apache2
  1. Access the installed Survey123 website using the base URL and reverse proxy point, for example:
https://some-machine.domain/survey123

Article ID: 000023967

Software:
  • Portal for ArcGIS
  • ArcGIS Survey123 Website

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options