如何在Azure服务上从http重定向到https [英] How to redirect from http to https on azure service

查看:85
本文介绍了如何在Azure服务上从http重定向到https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络配置中使用了以下代码



 <  重写 >  
< 规则 >
< rule name = redirecthttps stopProcessing = true > ;
< 匹配 url = (。*) / >
< 条件 >

< add input = {HTTPS} 模式 = ^ off $ / >
< / conditions > ;
< action 类型 = 重定向 url = https:// {HTTP-HOST} / {R:1} / >
< / rule >
< / rules >
< / rewrite >







但不能重定向到https ,我的代码有什么问题

解决方案

/ >
< / conditions >
< action type = 重定向 url = https:// {HTTP-HOST} / {R:1} / >
< / rule >
< / rules >
< / rewrite >







但不重定向到https,我的代码出了什么问题


尝试在模式中使用off而不是^ off




 <  条件 >  
< add 输入 = {HTTPS} pattern = off / >
< / conditions >


I used below code in web config

<rewrite>
          <rules>
               <rule name="redirecthttps" stopProcessing="true">
                   <match url="(.*)" />
                   <conditions>

                       <add input="{HTTPS}" pattern="^off$" />
                   </conditions>
                   <action type="Redirect" url="https://{HTTP-HOST}/{R:1}"/>
               </rule>
           </rules>
   </rewrite>




but not redirect to https, what's wrong in my code

解决方案

" /> </conditions> <action type="Redirect" url="https://{HTTP-HOST}/{R:1}"/> </rule> </rules> </rewrite>




but not redirect to https, what's wrong in my code


Try using "off" instead of "^off


" in the pattern:

<conditions>
    <add input="{HTTPS}" pattern="off" />
</conditions>


这篇关于如何在Azure服务上从http重定向到https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆