SuperMap iPortal built-in service proxy configuration

Feedback


The built-in service proxy of SuperMap iPortal refers to the service proxy function that comes with the iPortal product package, which is enabled by default. Besides, iPortal also provides a variety of optional function extension configurations, including: service access statistics , use the HTTPS protocol to enable the service proxy, and the service proxy caching functions. To make the service proxy performance better, it is recommended that you use MySQL/Oracle/PostgreSQL database to store portal data. For database configuration, please refer to: database configuration.

Service proxy configuration

As the iPortal portal administrator, you can set the service proxy related configuration through the sub-node element in the iportal.xml file in the %SuperMap iPortal_HOME%/webapps/iportal/WEB-INF directory. For details, please refer to: iPortal configuration file description.

Example:

   ...

<IportalConfig>

   <serviceProxy>

       <enable>true</enable>

       <enableBuiltinProxy>true</enableBuiltinProxy>

       <port>8195</port>

       <rootUrlPostfix>portalproxy</rootUrlPostfix>

       <httpConnPoolInfo>

            <maxTotal>100</maxTotal>

            <defaultMaxPerRoute>10</defaultMaxPerRoute>

            <connectionTimeout>30000</connectionTimeout>

            <socketTimeout>30000</socketTimeout>

      </httpConnPoolInfo>

   ...

   </serviceProxy>

</IportalConfig>

 

If the iPortal is running in a network environment with dual network adapters or multiple network adapters, to support accessing the proxied services with any ip of the machine, you need to add the <proxyServerRootUrl> node under <service Proxy>. The complete configuration is as follows:

<IportalConfig>

   ...

   <serviceProxy>

       <enable>true</enable>

       <enableBuiltinProxy>true</enableBuiltinProxy>

       <port>8195</port>

       <rootUrlPostfix>portalproxy</rootUrlPostfix>

       <proxyServerRootUrl>http://{ProxyHost}[:port]</proxyServerRootUrl>

       <httpConnPoolInfo>

            <maxTotal>100</maxTotal>

            <defaultMaxPerRoute>10</defaultMaxPerRoute>

            <connectionTimeout>30000</connectionTimeout>

            <socketTimeout>30000</socketTimeout>

      </httpConnPoolInfo>

   ...

   </serviceProxy>

</IportalConfig>

In the above configuration, {ProxyHost} is a placeholder, which will dynamically display the IP address; [:port] is a variable to represent the port, representing the listening port of the proxy service. For example: <proxyServerRootUrl>http://{ProxyHost}:8195</proxyServerRootUrl>

Note:

Proxied service access statistics configuration

To open the proxied service access statistics, you need to set <enableAccessStatistics> to true in iportal.xml like the following:

<IportalConfig>

   ...

   <serviceProxy>

       <enable>true</enable>

       <enableBuiltinProxy>true</enableBuiltinProxy>

       ...

      <!-- Proxy access statistics feature settings. Enabled by default -->

      <enableAccessStatistics>true</enableAccessStatistics>

   </serviceProxy>

</IportalConfig>

Enable the service proxy with the HTTPS protocol

The service proxy defaults to use http protocol, which means no matter the original registered service uses http or https, the proxied address uses http protocol. To configure supporting https, find the following section in <serviceProxy> element in iportal.xml:

<serviceProxy>

      ...

        <!-- Set which protocol to be used to enable proxy service. Http protocol will be used by default. If set to https, you need to set httpsSetting-->

        <!-- <scheme>http</scheme>

                   <httpsSetting>

                         <keyStorePath>D:\key.keystore</keyStorePath>

                         <keyStorePassword>123456</keyStorePassword>

                   </httpsSetting>  -->

    ...

</serviceProxy>

Comment out the above configuration, make the following changes(bold part)::

<serviceProxy>

      ...

        <!-- Set which protocol to be used to enable proxy service. Http protocol will be used by default. If set to https, you need to set httpsSetting-->

        <scheme>https</scheme>

                 <httpsSetting>

                        <keyStorePath>D:\key.keystore</keyStorePath>

                        <keyStorePassword>123456</keyStorePassword>

                 </httpsSetting>

    ...

</serviceProxy>

Note:

Service proxy caching configuration

The proxy caching is used to accelerate the access speed of proxied GIS services. The theory is to store the frequently used results of permission verifications and the mapping of original service and proxied service queried from database to cache.

Built-in proxy supports two cache types, Ehcache and Redis. Ehcache is used by default, you can use it directly.

Ehcache cache configuration

Ehcache configuration is shown as follows:

<serviceProxy>

    ...

    <cacheConfig>

        <enable>true</enable>

        <type>EHCACHE</type>

        <cacheServerConfig>

            <ehcacheConfigPath>./WEB-INF/iportal-ehcache.xml</ehcacheConfigPath>

            ...

        </cacheServerConfig>

    </cacheConfig>

</serviceProxy>

Redis cache configuration

Before configuring Redis cache, make sure you've installed Redis. To download and install Linux-version Redis, go to: https://redis.io/download.

This section takes Windows-version Redis as the example to show the configurations. Redis doesn't have an official Windows version. The Microsoft Open Tech group develops and matains a Win64 version, the download address is https://github.com/MicrosoftArchive/redis/releases.

After obtained the Redis, click redis_server.exe inside the folder to start Redis service. To ensure the proxy service's availability, the Redis service should always be available.

After installing and start Redis service, find <cacheConfig> element in iportal.xml.  Set the value of <type> under <cacheConfig> as REDIS, and remove the Ehcache config shown below in <cacheServerConfig> node.

<cacheName>iportalProxyCache</cacheName>

<ehcacheConfigPath>./WEB-INF/iportal-ehcache.xml</ehcacheConfigPath>

Comment out the Redis cache configuration shown as follows:

<serviceProxy>

    ...

    <cacheConfig>

        <enable>true</enable>

        <type>REDIS</type>

        <cacheServerConfig>

            <server>

               <nodes>192.168.112.231:7001</nodes>

               <timeout>3000</timeout>

               <password></password>

            </server>

            <jedisPoolConfig>

               <maxTotal>2048</maxTotal>

               <maxIdle>128</maxIdle>

               <maxWaitMillis>-1</maxWaitMillis>

               <testOnBorrow>true</testOnBorrow>

            </jedisPoolConfig>

        </cacheServerConfig>

    </cacheConfig>

</serviceProxy>

session sharing between iPortal and proxy service

It's essential to configure session sharing before proxy works successfully. Specifically, you need to configure to store the Cookie information of logged in users.

The built-in proxy supports two ways to store the Cookie of logged in uses: Ehcache and Redis cache. Ehcache is used by default, you can use it directly.

Ehcache cache configuration

Ehcache configuration is shown as follows:

<IportalConfig>

    ...

    <cookieStorage>

        <type>EHCACHE</type>

        <cacheServerConfig>

            <ehcacheConfigPath>./WEB-INF/iportal-ehcache.xml</ehcacheConfigPath>

            ...

        </cacheServerConfig>

    </cookieStorage>

</IportalConfig>

Redis cache configuration

If you've installed Redis service in previous step: Proxy service cache configuration, you only need to finish the following configurations.

Find <cookieStorage> sub-node in iportal.xml, set to use Redis cache, and remove the Ehcache config shown below in <cacheServerConfig> node.

<cacheName>iportalProxyCache</cacheName>

<ehcacheConfigPath>./WEB-INF/iportal-ehcache.xml</ehcacheConfigPath>

Comment out the Redis cache configuration shown as follows:

<IportalConfig>

    ...

    <cookieStorage>

        <type>REDIS</type>

        <cacheServerConfig>

            <server>

               <nodes>127.0.0.1:6379</nodes>

               <timeout>3000</timeout>

               <password></password>

            </server>

            <jedisPoolConfig>

               <maxTotal>512</maxTotal>

               <maxIdle>32</maxIdle>

               <maxWaitMillis>-1</maxWaitMillis>

               <testOnBorrow>true</testOnBorrow>

            </jedisPoolConfig>

         </cacheServerConfig>

      </cookieStorage>

    ...

</IportalConfig>