Thursday, April 23, 2015

Redirect http request to https on Microsoft Azure website

If you want force user to use https then you can create a redirect by following steps. Example is giving for Azure websites but it is possible in Azure Cloud app in many other way as it is more flexible.

Step 1:

Open you Azure portal go to you web app and on top menu choose Configure scroll down to certificates as show in figure.
Remember you need a valid SSL certificate for https otherwise it will show in red and it will be not trustworthy. Upload your certificate.
Go to ssl bindings section and select your domain, choose your SSL certificate to for requirement in case of multiple domains and certificates and then choose IP Based SSL.

Step 2:

Go to your web.config. Make sure choose the right one in case of multiple configs available.
Then paste this code.

        <rule name="Force HTTPS" enabled="true">
          <match url="(.*)" ignoreCase="false" />
            <add input="{HTTPS}" pattern="off" />
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />

Step 3:


If you want more detail step by step information please refer to source below.


No comments:

Post a Comment