Im Durchschnitt wird dieses Tutorial Redirect automatically from HTTP to HTTPS on an IIS behind a Load Balancer with SSL offloading mit 5 bewertet, wobei 1.0 die schlechteste und 5.0 die beste Bewertung ist. Es haben insgesamt 417 Besucher eine Bewertung abgegeben.
417 0

Redirect automatically from HTTP to HTTPS on an IIS behind a Load Balancer with SSL offloading

from gridscale Team HTTPS IIS LB Windows
tutorial - how to redirect automatically from HTTP to HTTPS on an IIS behind a Load Balancer with SSL offloading

Because HTTPS is becoming increasingly important

An automatic redirect from HTTP to HTTPS refers to an automated forwarding to the secure HTTPS protocol on port 443, in case a request should arrive at the uncertain HTTP protocol on port 80. Although the IIS can deal with HTTPS, HTTP requests are consequently ignored. Hence, it’s not suitable for a public webpage, since exceedingly few visitors go through the effort entering the URL manually with https: // upfront. Furthermore, search engine or other website inquiries will only work if the corresponding service stores the https-version of the link. In order to remedy this, you can configure an automatic redirection on the IIS, which turns HTTP requests into HTTP requests. If the IIS is behind a load balancer with SSL offloading, such as the free load balancer from gridscale, configure your load balancer and your IIS as described in this tutorial. If the website is operated without load balancers with SSL offloading on an IIS, use this Tutorial (German only) since the process is different in some instances.

Preparing the server

Configure your Load Balancer so that port 80 and port 443 both point to port 80 of the target computer. Then equip the HTTPS redirection with an SSL certificate, for example from Let’s Encrypt.
If you use gridscale’s load balancer, the whole thing looks like this:

gridscale's LBaaS verwenden

Watch out: To edit the port, you must switch to the expert mode.

Then log on to your web server via RDP as administrator and, if not already present, install the extension “URL Rewrite“. You can download them here.

Configuring the redirection

Switch to the root directory of your website and open the file web.config in an editor of your choice. I recommend Notepad ++. The free editor automatically detects line breaks and syntax errors.

Paste the following code into the file and then save it.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
           <rules>
         <rule name="HTTPS Redirect" enabled="true" stopProcessing="true">
              <match url="(.*)" />
             <conditions>
                 <add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" negate="true" />
            </conditions>
             <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" />
          </rule>
         </rules>
     </rewrite>
    </system.webServer>
</configuration>

Reboot your web server once again using the IIS and test if your request is automatically redirected when you open http: // <yourdomain> / in a browser of your choice.

Summary

With these simple steps, you can realize the redirection of HTTP to HTTPS behind a load balancer with SSL offloading. The use of HTTPS contributes significantly to the protection of communication, since the queries are encrypted. So it is recommended to redirect all HTTP requests to HTTPS. If you run your IIS without load balancer with SSL offloading, you can view this article (German only). 

Because HTTPS is becoming increasingly important An automatic redirect from HTTP to HTTPS refers to an automated forwarding to the secure HTTPS protocol on port 443, in case a request should arrive at the uncertain HTTP protocol on port 80. Although the IIS can deal with HTTPS, HTTP requests are consequently ignored. Hence, it’s not […]

Schade, dass dir der Artikel nicht gefallen hat.
Was sollten wir deiner Meinung nach besser machen?

Thank you for your feedback!
We will get back to you as soon as the article is finished.

Übrigens: kennst du schon unser Tutorial zum Thema Automatic IIS redirect http to https on Windows Server 2016?

×

Developer?

Get the latest gridscale developer tutorials here.
And don’t worry - we won’t spam you