IIS7.5 : Is there a way to use Require SSL and URL Rewrite Module together for https?

标签 iis ssl url-rewriting iis-7.5 url-rewrite-module

<分区>


想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。

关闭 10 年前

在 IIS7.5 中,我有一个 URL 重写规则,可以将 http 请求重定向到 https。如果我选中“需要 SSL”,我会收到 403 Unauthorized 而不是重定向,这是有道理的。

有没有办法一起使用它们?还会有好处吗?我假设不会,因为每个 http 请求都会被重定向,但我会在这里检查以防我错了。

这安全吗?

最佳答案

这两个选项的工作方式截然不同。

如果您使用要求 SSL 选项,您网站的每个页面都必须通过 HTTPS 访问,这意味着(如您所见),如果您忘记 HTTPS 并尝试使用 HTTP 访问,您将拥有403 未经授权。

如果您使用 URL 重写模块,您可以将某些页面或整个网站设置为重定向到 HTTPS(如果需要,将某些部分重定向回 HTTP),如果用户忘记了 HTTPS 并点击了 HTTP,他/她将被重定向到 HTTPS url。

至于让他们一起工作,有一个解决方案,但我真的不明白这一点:

[...] you will need to disable “Require SSL” checkbox for the web site. If you do not want to do that, then you can create two web sites in IIS – one with http binding and another with https binding – and then add this rule to the web.config file of the site with http binding.

http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx
(第 4 节。重定向到 HTTPS)

关于IIS7.5 : Is there a way to use Require SSL and URL Rewrite Module together for https?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15343915/

上一篇:asp.net - 调用网络服务 "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel"

下一篇:node.js - 在 Socket.IO Node.js 上安装 SSL

相关文章:

Firebase:在 URL 重写中传递 url 参数

apache - 强制通过 HTTPS 进行 HTTP 身份验证

PHP 应用程序无法与某些 MYSQL 数据库通信

css - 当我使用 IIS 部署我的 mvc 应用程序时,网页样式消失了

caching - IIS中设置 "Expire Web Content"通用http响应头

asp.net-mvc-3 - IIS 7.5 和 MVC 3 使用 Windows 身份验证 - 为静态内容获取 401,但永远不会提示输入凭据

amazon-web-services - 多个 ssl 证书可以保护同一个子域吗?

apache - 重定向错误 : Wordpress + Let's Encrypt (Certbot) + SSL only + non-www

postgresql - 将 AWS PostgreSQL 连接到 Power BI Desktop :The specified hostname was not present in the certificate

docker - MinIO + Docker - 不能使用新版本的 SSL 证书(x509 不包含任何 IP sans)