logo

分享 asp.net网站http自动跳转https的方法

用户2072 313 阅读 0 评论 2021-09-01 09:01

asp.net网站http自动跳转https的方法 直接在webconfig中配置即可

需要安装  rewirte 组件


    <rewrite>
      <outboundRules rewriteBeforeCache="true">
        <rule name="Remove Server header">
          <match serverVariable="RESPONSE_Server" pattern=".+" />
          <action type="Rewrite" value="nginx" />
        </rule>
      </outboundRules>
      <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
        </rule>
      </rules>
    </rewrite>


充电支持Ta
精选评论
加载中~