zoukankan      html  css  js  c++  java
  • IIS ARR设置HTTP跳转到HTTPS

    GUI Version

    - Select the website you wish to configure
    - In the “Features View” panel, double click URL Rewrite

    You will notice there are currently no rules configured for this site. Click “Add Rules…” in the Actions menu to the right of the “Features View” panel

    Use the default “Blank rule” and press “OK”.

    When editing a rule there are the “Name” field and 4 configuration pull down boxes.

    - Enter “Redirect to HTTPS” in the name field.
    - Next we will configure the first configuration pull down box called “Match URL”, on the right side of “Match URL” press the down arrow to expand the box.

    Within the “Match URL” configuration box we will set the following settings:

    Requested URL: Matches the Pattern
    Using: Regular Expressions
    Pattern: (.*)

    We can now edit the next configuration pull down box which is “Conditions”, Press “Add…” to add a new condition to the configuration.

    We will configure the condition with the following settings:

    Condition Input: {HTTPS}
    Check if input string: Matches the Pattern
    Pattern: ^OFF$

    Press “OK”

    You should see your condition in the list of conditions.

    For this setting we do not need to configure the “Server Variables” pull down box. Continue onto the “Action” configuration box and pull down the box by selecting the arrow on the right. We will configure the following settings for the “Action” configuration:

    Action Type: Redirect
    Redirect URL: https://{HTTP_HOST}/{R:1}
    Redirect Type: See Other (303)

    Press “Apply” then press “Back to Rules”

    You should now see the rule configured on the main screen of the URL Rewrite module.

    Test your site, it should now redirect from HTTP to HTTPS.

    If we exam the web.config file we can see where the rule was entered. If we entered the rule directly into the web.config file it would show up in the GUI.

    Web.Config Rule

    You can also edit the web.config file of the site directly and you will be able to see the rule in the GUI. You will need to enter the following within the <system.webServer> </system.webServer> elements.

    <rule name="Redirect to HTTPS" stopProcessing="true">
    
    <match url="(.*)" />
    
    <conditions><add input="{HTTPS}" pattern="^OFF$" />
    
    </conditions>
    
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
    
    </rule>

    When implementing this solution you need to make sure to use relative paths for all references on your page because there is a possibility you will get a warning asking you if you want to display secure and insecure items. For example, if you have a logo on your page and the URL to this logo is http://domain/images/logo.jpg, do not use the whole path because including the http:// will hard code this image to use http and not https. Instead use /images/logo.jpg.

    原文地址: http://www.jppinto.com/2010/03/automatically-redirect-http-requests-to-https-on-iis7-using-url-rewrite-2-0/

  • 相关阅读:
    mysql5.7 linux安装参考
    谈谈微服务中的 API 网关(API Gateway)
    十大Intellij IDEA快捷键
    SqoopFlume、Flume、HDFS之间比较
    PostgreSQL-存储过程(一)基础篇
    spark调优篇-oom 优化(汇总)
    spark调优篇-数据倾斜(汇总)
    spark调优篇-Spark ON Yarn 内存管理(汇总)
    spark异常篇-OutOfMemory:GC overhead limit exceeded
    spark异常篇-Removing executor 5 with no recent heartbeats: 120504 ms exceeds timeout 120000 ms 可能的解决方案
  • 原文地址:https://www.cnblogs.com/niusys/p/automatically-redirect-http-requests-to-https-on-iis7-using-url-rewrite-2-0.html
Copyright © 2011-2022 走看看