Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTTP到HTTPS重定向在移动设备上不起作用-IIS_Http_Redirect_Iis_Https_Web Config - Fatal编程技术网

HTTP到HTTPS重定向在移动设备上不起作用-IIS

HTTP到HTTPS重定向在移动设备上不起作用-IIS,http,redirect,iis,https,web-config,Http,Redirect,Iis,Https,Web Config,我试图在IIS上设置规则,以便在用户通过HTTP进入站点时重定向到HTTPS。现在,如果用户通过桌面计算机浏览站点,我当前的代码将重定向到HTTPS。然而,当在任何手机上通过HTTP访问我的网站时,它只是超时而已 下面是我当前的web.config文件的外观: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> <

我试图在IIS上设置规则,以便在用户通过HTTP进入站点时重定向到HTTPS。现在,如果用户通过桌面计算机浏览站点,我当前的代码将重定向到HTTPS。然而,当在任何手机上通过HTTP访问我的网站时,它只是超时而已

下面是我当前的
web.config
文件的外观:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <system.webServer>
   <httpProtocol>
     <customHeaders>
       <add name="Access-Control-Allow-Origin" value="*" />
     </customHeaders>
   </httpProtocol>
        <httpRedirect enabled="false" destination="https://mywebsitehere.com" />
        <rewrite>
            <rules>
                <rule name="http to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://mywebsitehere.com/{R:1}" redirectType="SeeOther" />
                </rule>
            </rules>
        </rewrite>
 </system.webServer>
</configuration>

除了启用失败请求跟踪,您还可以尝试使用计算机作为代理,然后移动设备通过计算机发送请求。然后使用诸如fidder之类的工具捕获分析请求。
<rule name="Mobile Rewrite" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*" ignoreCase="true" negate="false" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
    <add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" />
    <add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|phone" />
    <add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" />
</conditions>
<action type="Redirect" url="http://mysite.mobi" appendQueryString="false" redirectType="Found" />
</rule>