How to set Http redirect to HTTPS directly on Storefront server

How to set Http redirect to HTTPS directly on Storefront server

book

Article ID: CTX493112

calendar_today

Updated On:

Description

When user access Storefront site web with http://sfurl.com/citrix/storeweb , it can be auto redirected into https://sfurl.com/citrix/storeweb. 


Instructions

  1. Download and install the URL Rewrite module install on Storefront Server. Download link : https://www.iis.net/downloads/microsoft/url-rewrite
  2. Open the IIS Manager console and select the website you would like to apply the redirection to in the left-side menu:

    image.png

  3. Double-click on the URL Rewrite icon.
  4. Click Add Rule(s) in the right-side menu.
  5. Select Blank Rule in the Inbound section, then press OK.

    iisred2

  6. Enter any rule name you wish.
  7. In the Match URL section:

    - Select Matches the Pattern in the Requested URL drop-down menu
    - Select Regular Expressions in the Using drop-down menu
    - Enter the following pattern in the Match URL section: (.*)
    - Check the Ignore case box

    iisred3

  8. In the Conditions section, select Match all under the Logical Grouping drop-down menu and press Add.
  9. In the prompted window:


    - Enter {HTTPS} as a condition input
    - Select Matches the Pattern from the drop-down menu
    - Enter ^OFF$ as a pattern
    - Press OK

    iisred4

  10. In the Action section, select Redirect as the action type and specify the following for Redirect URL:

    https://{HTTP_HOST}{REQUEST_URI}

  11. Un-check the Append query string box.
  12. Select the Redirection Type of your choice. The whole Action section should look like this:

    iisredirect5

  13. Click on Apply on the right side of the Actions menu.

The IIS redirect can be checked by accessing your site via http:// specified in the URL. To make sure that your browser displays not the cached version of your site, you can use anonymous mode of the browser.

 

Normally, the redirection rule gets written into the web.config file located in the document root directory of your website. If the redirection does not work for some reason, make sure that web.config exists and check if it contains the appropriate rule.

To do this, follow these steps:

  1. In the sites list of IIS, right-click on your site. Choose the Explore option:

    image.png

  2. Explore will open the document root directory of the site. Check if the web.config file is there.
  3. Make sure the web.config file already had the following code block:
    <configuration>
     <system.webServer>
     <rewrite>
     <rules>
     <rule name="HTTPS force" enabled="true" stopProcessing="true">
     <match url="(.*)" />
     <conditions>
     <add input="{HTTPS}" pattern="^OFF$" />
     </conditions>
     <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
     </rule>
     </rules>
     </rewrite>
     </system.webServer>
    </configuration>
    

Then we do IISREST in SF server command line. And then use incognito mode in browser to test the auto redirect to https.