使用 IIS Express 模拟 SSL 终止

发布于 2025-01-02 20:36:16 字数 453 浏览 1 评论 0原文

在我们的生产环境中,网站在 HTTPS 下运行,SSL 在负载均衡器上终止,并将流量作为 HTTP 传递到 IIS 服务器。

站点内有各种内部和第 3 方组件和控件,其中一些使用类似于 .NET System.Web.HttpRequest.IsSecureConnection 属性的机制,该属性仅查询 HTTPS< /code> 服务器变量返回其结果。由于从负载均衡器到 Web 服务器的连接是 HTTP,因此这些方法返回不正确的值并导致某些组件失败。例如,某个组件可能会将用户定向到 JavaScript 文件的 HTTP URL(而不是 HTTPS),并导致浏览器不加载混合内容。

为了调试这些组件并开发解决方法,我需要在我的开发计算机上重新创建此场景。我的问题是,是否有一种简单的方法可以为 Visual Studio / IIS Express 开发环境模拟外部终止的 SSL 连接?

In our production environment a website runs under HTTPS with SSL terminating on a load balancer and passing traffic to the IIS servers as HTTP.

There are various in-house and 3rd party components and controls within the site and some of them use mechanisms similar to the .NET System.Web.HttpRequest.IsSecureConnection property which simply queries the HTTPS server variable to return its result. As the connection into the web server from the load balancer is HTTP, these methods return the incorrect value and cause some components to fail. For example, a component might direct the user to a HTTP URL instead of HTTPS for a JavaScript file and cause the browser not to load the mixed content.

In order to debug these components and to develop a workaround, I need to recreate this scenario on my development machine. My question is Is there an easy way to simulate an externally terminated SSL connection for the Visual Studio / IIS Express development environment?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浴红衣 2025-01-09 20:36:16

我找到了一种使用 端口 的方法转发向导

创建一个 TCP 映射,将侦听端口设置为备用端口(例如 443),目标为具有 Web 服务器端口(例如 80)的本地主机。将其他所有内容保留为默认值,但进入 SSL 加密并在 CA 中心生成根密钥和证书。完成后,选择启用 SSL 加密并选择服务器。生成私钥文件、Cert Req 文件和证书,然后 bob 是你的叔叔,你将终止 SSL 转发到本地 IIS Express 服务器:只需启动端口映射,然后连接到 https://localhost(如果不是 443,请指定端口)。

I've found a way using Port Forwarding Wizard.

Create a single TCP mapping with Listen Port set to a spare port (e.g. 443), destination as localhost with web server port (e.g. 80). Leave everything else as default, but go into SSL Encryption and generate a Root Key and Certificate in CA Center. Once done, select Enable SSL Encryption and select Server. Generate a Private Key file, Cert Req file and a Certificate and then bob's your uncle, you get terminated SSL forwarding to your local IIS Express server: Simply Start your port mapping and then connect to https://localhost with your web browser (specifying the port if it's not 443).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文