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

From Mea Wiki
Jump to navigation Jump to search
(Created page with "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 po...")
 
 
(32 intermediate revisions by 4 users not shown)
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 UI http/https traffic though IIS, i.e. setting up IIS to work as a reverse proxy. It has the following advantages:
 +
* Access QPR UI using more standard ports (usually 80 or 443) instead of GlassFish ports (usually 8080 or 8181).
 +
* QPR UI can use HTTPS connection that is configured in IIS, and then there is not need to configure https in GlassFish.
 +
* External presentation objects and embedded QPR Portal works better as the browser considers they are from the same site because same origin policy won't cause restrictions (more information: https://en.wikipedia.org/wiki/Same-origin_policy)
  
# Install '''Microsoft Web Platform Installer''' from http://www.microsoft.com/web/downloads/platform.aspx.
+
More information about reverse proxies: https://en.wikipedia.org/wiki/Reverse_proxy.
# Use it to install '''URL Rewrite''' and '''Application Request Routing''' modules.
+
 
# Create file C:\inetpub\wwwroot\m\web.config with following contents:
+
== 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.1''' (or newer) and '''Application Request Routing 3.0''' (or newer) modules. Use the search box to find these components. If you had the IIS Manager open while installing the components, restart the IIS Manager.
 +
 
 +
2. 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 17:
 
   <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 36:
 
</configuration>
 
</configuration>
 
</pre>
 
</pre>
# Create file C:\inetpub\wwwroot\EnticeServices\web.config with following contents:
+
 
 +
3. Create file '''C:\inetpub\wwwroot\ui\web.config''' with following contents (also create the '''ui''' folder):
 +
 
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
Line 36: Line 45:
 
   <rewrite>
 
   <rewrite>
 
     <rules>
 
     <rules>
       <rule name="Reverse Proxy to EnticeServices" stopProcessing="true">
+
       <rule name="Reverse Proxy to QPR UI" stopProcessing="true">
 
         <match url="(.*)" />
 
         <match url="(.*)" />
         <action type="Rewrite" url="http://localhost:8080/EnticeServices/{R:1}" />
+
         <action type="Rewrite" url="http://localhost:8080/ui/{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 64:
 
</configuration>
 
</configuration>
 
</pre>
 
</pre>
# Open IIS Management Console, click '''Application Requests Routing Cache''' in server level, click '''Server Proxy settins''', 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
+
4. Open '''Internet Information Services (IIS) Console''', click the top level in the left side hierarchy, doubleclick '''Application Requests Routing Cache''', click '''Server Proxy settings''' on the right pane, click '''Enable Proxy''' and click '''Apply'''.
# Do the same for '''EnticeServices''' folder.
+
 
# To harder security, in GlassFish allow incoming requests only from localhost.
+
5. In '''Internet Information Services (IIS) Console''', click '''EnticeServices''' folder in the left side hierarchy and double-click '''URL Rewrite'''.
 +
 
 +
6. Click '''View Server Variables...''', and add '''HTTP_X_ORIGINAL_ACCEPT_ENCODING''' and '''HTTP_ACCEPT_ENCODING''' using the '''Add''' button.
 +
 
 +
7. Do the steps 5. and 6. also for the '''ui''' folder.
 +
 
 +
8. QPR UI can now be accessed using url '''http(s)://SERVER/ui/''' where SERVER is the hostname of the server.
 +
 
 +
'''Offline installers:'''
 +
* URL Rewrite module: http://download.microsoft.com/download/D/D/E/DDE57C26-C62C-4C59-A1BB-31D58B36ADA2/rewrite_amd64_en-US.msi
 +
* Application Request Routing: https://www.microsoft.com/en-us/download/confirmation.aspx?id=47333
 +
 
 +
[[Category: QPR UI]]

Latest revision as of 07:51, 8 January 2019

Follow these instructions to route QPR UI http/https traffic though IIS, i.e. setting up IIS to work as a reverse proxy. It has the following advantages:

  • Access QPR UI using more standard ports (usually 80 or 443) instead of GlassFish ports (usually 8080 or 8181).
  • QPR UI can use HTTPS connection that is configured in IIS, and then there is not need to configure https in GlassFish.
  • External presentation objects and embedded QPR Portal works better as the browser considers they are from the same site because same origin policy won't cause restrictions (more information: https://en.wikipedia.org/wiki/Same-origin_policy)

More information about reverse proxies: https://en.wikipedia.org/wiki/Reverse_proxy.

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.1 (or newer) and Application Request Routing 3.0 (or newer) modules. Use the search box to find these components. If you had the IIS Manager open while installing the components, restart the IIS Manager.

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>

3. Create file C:\inetpub\wwwroot\ui\web.config with following contents (also create the ui folder):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
  <rewrite>
    <rules>
      <rule name="Reverse Proxy to QPR UI" stopProcessing="true">
        <match url="(.*)" />
        <action type="Rewrite" url="http://localhost:8080/ui/{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>

4. Open Internet Information Services (IIS) Console, click the top level in the left side hierarchy, doubleclick Application Requests Routing Cache, click Server Proxy settings on the right pane, click Enable Proxy and click Apply.

5. In Internet Information Services (IIS) Console, click EnticeServices folder in the left side hierarchy and double-click URL Rewrite.

6. Click View Server Variables..., and add HTTP_X_ORIGINAL_ACCEPT_ENCODING and HTTP_ACCEPT_ENCODING using the Add button.

7. Do the steps 5. and 6. also for the ui folder.

8. QPR UI can now be accessed using url http(s)://SERVER/ui/ where SERVER is the hostname of the server.

Offline installers: