Setting up IIS as Reverse Proxy for QPR UI

From Mea Wiki
Revision as of 14:34, 18 March 2017 by Ollvihe (talk | contribs)
Jump to navigation Jump to search

Follow these instructions to route QPR MobileDashboard HTTP traffic though IIS. It allows to use QPR MobileDashboard in IIS port (usually 80) instead of QPR MobileDashboard port (usually 8080). In addition, HTTPS can be configured in IIS, instead of GlassFish.

  1. Install Microsoft Web Platform Installer from http://www.microsoft.com/web/downloads/platform.aspx.
  2. Use it to install URL Rewrite and Application Request Routing modules.
  3. Create file C:\inetpub\wwwroot\m\web.config with following contents:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
  <rewrite>
    <rules>
      <rule name="Reverse Proxy to mobiledash" stopProcessing="true">
        <match url="(.*)" />
        <action type="Rewrite" url="http://localhost:8080/mobiledash/{R:1}" />
		<serverVariables>
          <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
          <set name="HTTP_ACCEPT_ENCODING" value="" />
        </serverVariables>
      </rule>
    </rules>
    <outboundRules>
      <rule name="Change port">
        <match filterByTags="A, Form, Img" pattern="^http://localhost:8080/(.*)" />
        <action type="Rewrite" value="http://localhost/{R:1}" />
      </rule>
    </outboundRules>
  </rewrite>
  </system.webServer>
</configuration>
  1. Create file C:\inetpub\wwwroot\EnticeServices\web.config with following contents:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
  <rewrite>
    <rules>
      <rule name="Reverse Proxy to EnticeServices" stopProcessing="true">
        <match url="(.*)" />
        <action type="Rewrite" url="http://localhost:8080/EnticeServices/{R:1}" />
		<serverVariables>
          <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
          <set name="HTTP_ACCEPT_ENCODING" value="" />
        </serverVariables>
      </rule>
    </rules>
    <outboundRules>
      <rule name="Change port">
        <match filterByTags="A, Form, Img" pattern="^http://localhost:8080/(.*)" />
        <action type="Rewrite" value="http://localhost/{R:1}" />
      </rule>
    </outboundRules>
  </rewrite>
  </system.webServer>
</configuration>
  1. Open IIS Management Console, click Application Requests Routing Cache in server level, click Server Proxy settins, click Enable Proxy.
  2. In IIS Management Console, click m and URL Rewrite, View server variables, and add HTTP_X_ORIGINAL_ACCEPT_ENCODING and HTTP_ACCEPT_ENCODING using Add button
  3. Do the same for EnticeServices folder.
  4. To harden security, in GlassFish allow incoming requests only from localhost.