Friday, June 24, 2022

[FIXED] How to Enable SSL offloading on IIS Reverse Proxy

Issue

I have just enabled Reverse Proxy for my NodeJS application on Windows Server by enabling Application Request Routing (ARR) and editing the web.config file by following this article:

https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing

Now, everything is working fine, I am able to access my NodeJS application running on localhost from an external client outside the server. I want to enforce Https connection to this reverse proxy I've just created. How do I achieve this?


Solution

IIS URL Rewrite extension could accomplish this task. Please Install the extension.
https://www.iis.net/downloads/microsoft/url-rewrite
In order to force HTTP connection to https connection, please add the below Url rules in the webconfig file which can be recognized by IIS.

<system.webServer>
           <rewrite>
            <rules>
              <rule name="Force SSL (https)" enabled="true" stopProcessing="false">
                <match url="(.*)" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                  <add input="{HTTPS}" pattern="off" />
                </conditions>
                <action type="Redirect" url="https://example.com/{REQUEST_URI}" redirectType="Permanent" />
              </rule>
            </rules>
          </rewrite>
    </system.webServer>

Alternatively, we could manually set up the rule by using the URL Rewrite extension after installation.
enter image description here
enter image description here
enter image description here
Feel free to let me know if there is anything I can help with.



Answered By - Abraham Qian
Answer Checked By - Clifford M. (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.