Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ajay Sogi 5 posts 105 karma points
    Aug 24, 2018 @ 13:29
    Ajay Sogi
    0

    How to implement HTTP to HTTPS redirects on a Umbraco website on Azure

    Hi.

    I was hoping someone would be able to point me in the right direction with this one.

    I have an Umbraco website running on v7.4.3 and was wondering what the best way would be to implement the redirects from HTTP to HTTPS.

    I have bumped into alot of examples regarding this on other platforms, but nothing thats specific for Azure.

    I wanted to ask what method is considered as best practice to adopt and execute on the website. I want to avoid using packages if possible.

    Any feedback would be highly appreciated.

    Thanks in advance!

  • Gonçalo Chaves 14 posts 125 karma points
    Aug 24, 2018 @ 13:48
    Gonçalo Chaves
    1

    Hi Ajay,

    I'm assuming that you're using your umbraco on an Azure website instead of the Umbraco Cloud solution itself right? If yes, I believe that after you configure the https binding you can easily add on your web.config file the following:

    <configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
    

    Please be aware if you want a permenent redirect (301) or if you just need a temporary one (302)... maybe not. Also please check the umbraco backoffice flag to use https, under the application settings on web.config file:

    <add key="umbracoUseSSL" value="true" />
    

    Hope that helps

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies