HTTP Redirect with port number to HTTPS and drop the port number [Answered]RSS

3 replies

Last post Jan 20, 2021 01:47 AM by arvvie

  • HTTP Redirect with port number to HTTPS and drop the port number

    Jan 18, 2021 12:47 AM|arvvie|LINK

    Hi

    Running on IIS 10.

    Need help redirecting non-ssl with a port number i.e. http://domainname.com:8090/Foldername and hope to drop the port number and rewrite to https://domainname.com/Foldername.

    Please help with the ruleset or any other config that needs to be done to achieve this?

    Thanks.

  • Re: HTTP Redirect with port number to HTTPS and drop the port number

    Jan 18, 2021 06:43 AM|Jalpa Panchal|LINK

    Hi,

    You could try to use the below rule:

      <rule name="HTTP to HTTPS" enabled="true" stopProcessing="true">
                        <match url="(.*)" ignoreCase="true" />
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="true">
                            <add input="{HTTPS}" pattern="off" />
                            <add input="{HTTP_HOST}" pattern="([^/:]*?):[^/]*?" />
                        </conditions>
                        <action type="Redirect" url="https://{C:1}/{R:0}" appendQueryString="true" />
                    </rule>

    Regards,

    Jalpa

    .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 Redirect with port number to HTTPS and drop the port number

    Jan 19, 2021 07:47 AM|mubaohiemquangcao|LINK

    thanks

  • Re: HTTP Redirect with port number to HTTPS and drop the port number

    Jan 20, 2021 01:47 AM|arvvie|LINK

    Thank you Jalpa. Worked perfectly. Great solution.

    Thanks,

    Arvvie