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 969 Besucher eine Bewertung abgegeben.
969 0

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

from gridscale Team HTTPS IIS 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 the automatic forwarding off HTTP to the secure HTTPS protocol on port 443 in case a request should arrive at the unsecure 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 very few visitors go through the effort of entering the URL manually with https://. Furthermore, search engines or other website crawlers 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 HTTPS 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 and SSL offloading on an IIS, use this Tutorial (German only) since the process may be different.

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, it will look like this:

gridscale's LBaaS verwenden

Note: To edit the port, you must switch to 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 it 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 ++. This free text 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 more 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 can create your own 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 a 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 the automatic forwarding off HTTP to the secure HTTPS protocol on port 443 in case a request should arrive at the unsecure HTTP protocol on port 80. Although the IIS can deal with HTTPS, HTTP requests are consequently ignored. Hence, […]

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 Setting up WebDAV on Windows Server 2016?

×

Developer?

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