【问题标题】:HTTP to HTTPS redirect in IIS 8IIS 8 中的 HTTP 到 HTTPS 重定向
【发布时间】:2018-02-04 03:13:13
【问题描述】:

https://testitnow.in/edgar 是基于 ASP 构建的网站。我在 IIS 中配置了自动重定向,但是,如果我在 Web 浏览器中键入 testitnow.in,我会收到以下错误 - “403 - 禁止访问:访问被拒绝。 您无权使用您提供的凭据查看此目录或页面。"

但如果我输入 https://testitnow.in 或 www.testitnow.in,它会重定向到 https://testitnow.in。请帮我解决这个问题。

【问题讨论】:

标签: asp.net server iis-8 windows-server-2012


【解决方案1】:

尝试更新您的 web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

【讨论】:

  • 我已经添加了这段代码。但是,重定向也没有发生。我需要 HTTP 和 HTTPS 都应该在浏览器上工作。但是如果用户强行输入 HTTP,它应该告诉用户这个站点是不安全的。我可以在 IIS 上做吗?
  • 您可以使用 JavaScript 检测 HTTP 或 HTTPS
  • 向用户发出警告信息后
猜你喜欢
  • 2016-02-26
  • 2019-09-03
  • 2013-05-02
  • 2016-05-31
  • 2011-09-16
  • 1970-01-01
  • 2019-08-17
  • 2013-03-23
相关资源
最近更新 更多