如何配置 IIS 10 以将请求转发到 Web 应用程序

问题描述 投票:0回答:1

我想要 IIS 10 将请求重定向到其他几个 Web 应用程序(ASP.NET Core 6.0 和 Angular 14)
假设我让 Kestrel 在 http://localhost:5009/ 上监听其中一个应用程序,我想输入

http://localhost/PassThrough/ 

进入浏览器地址并将其重定向到

http://localhost:5171/

还有

http://localhost/PassThrough/todo/param1

http://localhost:5171/todo/param1

更新: 尝试了答案中建议的重写 URL 方法

iis reverse-proxy
1个回答
0
投票

IIS提供官方组件,URL重定向反向代理都可以满足您的需求

  1. 获取 URL 重写模块: https://iis-umbraco.azurewebsites.net/downloads/microsoft/url-rewrite。 可以参考官方文档中的步骤来 创建重定向规则,从 http://localhost/App1/ 重定向到 http://localhost:5009/.

  2. 反向代理需要应用程序请求路由: https://iis-umbraco.azurewebsites.net/downloads/microsoft/application-request-routing.

    配置反向代理规则: https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing#configuring-rules-for -反向代理.

URL重定向和反向代理的官方文档有详细的步骤和参考示例

© www.soinside.com 2019 - 2024. All rights reserved.