HTTP to HTTPS reditecr does not work on initial connectionRSS

2 replies

Last post Jan 07, 2021 03:24 PM by nickmangioros

  • HTTP to HTTPS reditecr does not work on initial connection

    Jan 06, 2021 03:45 PM|nickmangioros|LINK

    Hi,

    I have the following script:

    <rewrite>
        <rules>
            <rule name="Redirect to http" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
                <match url="*" negate="false" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{HTTPS}" pattern="off" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
            </rule>
        </rules>
    </rewrite>

    However on the initial connection to the web site does not go to HTTPS

    example, I type  http://www. website.com  and it goes to http://www. website.com 

                   once on the site and click on a hyperlink it does go to https://www. website.com/fr

    What am I missing to set this to work correctly.

    Note:  Have tried similar scripts to the one above as well.

    Thanks for your help

  • Re: HTTP to HTTPS reditecr does not work on initial connection

    Jan 07, 2021 05:26 AM|Brucz|LINK

    Hi nickmangioros,

    I test the rule in my local IIS, it can work. I think it has no problem.

    Please enable fail reuqest tracing to trace the request and find the issue.

    Best regards,

    Brucz

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: HTTP to HTTPS reditecr does not work on initial connection

    Jan 07, 2021 03:24 PM|nickmangioros|LINK

    Thank your for your reply,

    I will do this and let you know on my findings.

    Nick