Difference between revisions of "Setting up IIS as Reverse Proxy for QPR UI"

From Mea Wiki
Jump to navigation Jump to search
m
m
Line 1: Line 1:
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.
+
Follow these instructions to route QPR MobileDashboard HTTP traffic though IIS. It has the following advantages:
 +
* access QPR MobileDashboard using IIS port (usually 80) instead of QPR MobileDashboard port (usually 8080).
 +
* QPR MobileDashboard can use HTTPS connection that is configured in IIS, and thus there is not need to configure HTTS in GlassFish.
 +
* External presentation objects and QPR Portal works better as the browser considers they are from the same site ([same origin policy|https://en.wikipedia.org/wiki/Same-origin_policy] won't cause restrictions)
  
# Install '''Microsoft Web Platform Installer''' from http://www.microsoft.com/web/downloads/platform.aspx.
+
Instructions:
# Use it to install '''URL Rewrite''' and '''Application Request Routing''' modules.
+
# Download and run '''Microsoft Web Platform Installer''' (available in http://www.microsoft.com/web/downloads/platform.aspx). Use it to install '''URL Rewrite 2.0''' and '''Application Request Routing 3.0''' modules. Use the search box to find these components.
# Create file C:\inetpub\wwwroot\m\web.config with following contents:
+
# Create file '''C:\inetpub\wwwroot\EnticeServices\web.config''' with following contents (also create the '''EnticeServices''' folder):
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
Line 10: Line 13:
 
   <rewrite>
 
   <rewrite>
 
     <rules>
 
     <rules>
       <rule name="Reverse Proxy to mobiledash" stopProcessing="true">
+
       <rule name="Reverse Proxy to EnticeServices" stopProcessing="true">
 
         <match url="(.*)" />
 
         <match url="(.*)" />
         <action type="Rewrite" url="http://localhost:8080/mobiledash/{R:1}" />
+
         <action type="Rewrite" url="http://localhost:8080/EnticeServices/{R:1}" />
<serverVariables>
+
<serverVariables>
 
           <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
 
           <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
 
           <set name="HTTP_ACCEPT_ENCODING" value="" />
 
           <set name="HTTP_ACCEPT_ENCODING" value="" />
Line 29: Line 32:
 
</configuration>
 
</configuration>
 
</pre>
 
</pre>
# Create file C:\inetpub\wwwroot\EnticeServices\web.config with following contents:
+
# Create file '''C:\inetpub\wwwroot\m\web.config''' with following contents (also create the '''m''' folder):
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
Line 36: Line 39:
 
   <rewrite>
 
   <rewrite>
 
     <rules>
 
     <rules>
       <rule name="Reverse Proxy to EnticeServices" stopProcessing="true">
+
       <rule name="Reverse Proxy to mobiledash" stopProcessing="true">
 
         <match url="(.*)" />
 
         <match url="(.*)" />
         <action type="Rewrite" url="http://localhost:8080/EnticeServices/{R:1}" />
+
         <action type="Rewrite" url="http://localhost:8080/mobiledash/{R:1}" />
<serverVariables>
+
<serverVariables>
 
           <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
 
           <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
 
           <set name="HTTP_ACCEPT_ENCODING" value="" />
 
           <set name="HTTP_ACCEPT_ENCODING" value="" />
Line 55: Line 58:
 
</configuration>
 
</configuration>
 
</pre>
 
</pre>
# Open IIS Management Console, click '''Application Requests Routing Cache''' in server level, click '''Server Proxy settins''', click '''Enable Proxy'''.
+
# Open '''Internet Information Services (IIS) Console''', click the top level in the left side hierarchy, doubleclick '''Application Requests Routing Cache''', click '''Server Proxy settins''' on the right pane, and click '''Enable Proxy'''.
# 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
+
# In '''Internet Information Services (IIS) Console''', click '''EnticeServices''' folder in the left side hierarchy, click '''URL Rewrite''', '''View Server Variables...''' variables, and add '''HTTP_X_ORIGINAL_ACCEPT_ENCODING''' and '''HTTP_ACCEPT_ENCODING''' using the '''Add''' button. # Do the same for the '''m''' folder.
# Do the same for '''EnticeServices''' folder.
+
# To harden the security, in '''GlassFish''' allow incoming requests only from localhost (detailed instructions will follow...).
# To harden security, in GlassFish allow incoming requests only from localhost.
 

Revision as of 17:45, 18 March 2017

Follow these instructions to route QPR MobileDashboard HTTP traffic though IIS. It has the following advantages:

  • access QPR MobileDashboard using IIS port (usually 80) instead of QPR MobileDashboard port (usually 8080).
  • QPR MobileDashboard can use HTTPS connection that is configured in IIS, and thus there is not need to configure HTTS in GlassFish.
  • External presentation objects and QPR Portal works better as the browser considers they are from the same site ([same origin policy|https://en.wikipedia.org/wiki/Same-origin_policy] won't cause restrictions)

Instructions:

  1. Download and run Microsoft Web Platform Installer (available in http://www.microsoft.com/web/downloads/platform.aspx). Use it to install URL Rewrite 2.0 and Application Request Routing 3.0 modules. Use the search box to find these components.
  2. Create file C:\inetpub\wwwroot\EnticeServices\web.config with following contents (also create the EnticeServices folder):
<?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. Create file C:\inetpub\wwwroot\m\web.config with following contents (also create the m folder):
<?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. Open Internet Information Services (IIS) Console, click the top level in the left side hierarchy, doubleclick Application Requests Routing Cache, click Server Proxy settins on the right pane, and click Enable Proxy.
  2. In Internet Information Services (IIS) Console, click EnticeServices folder in the left side hierarchy, click URL Rewrite, View Server Variables... variables, and add HTTP_X_ORIGINAL_ACCEPT_ENCODING and HTTP_ACCEPT_ENCODING using the Add button. # Do the same for the m folder.
  3. To harden the security, in GlassFish allow incoming requests only from localhost (detailed instructions will follow...).