azure - 如何将请求重定向到通过 Azure 应用服务托管的不同 Web 应用
问题描述
我有两个通过 Azure Web 服务托管的 Web 应用程序,分别带有 URLhttps://example1.azurewebsites.net
和https://example2.azurewebsites.net
。
我正在看的是我想将请求重定向example1
到,example2
而不需要任何代码更改或重新部署。我不太确定 Azure Web 服务是否支持这种开箱即用的配置。如果是这样,最好的选择是什么?
更新:为了澄清,所有请求的 URL 都需要更改为example2
from example1
。
解决方案
最简单的方法是使用重定向规则更新您的 web.config。您甚至可以在 WebApp 的 SCM 站点中编辑 web.config,甚至无需 FTP 进入或重新部署。这是微软文档。
这段代码应该可以做到,但我还没有测试过。
<system.webServer>
<httpRedirect enabled="true" destination="http://www.contoso.com/" />
</system.webServer>
推荐阅读
- python - 执行connection.commit()后,为什么其他cursor.execute()不能正常工作?
- slider - Ionic 4 vue - 获取幻灯片索引
- spring - 在 JBoss 上部署战争时,@Async 注释不起作用
- javascript - 正则表达式为真时返回假
- authorization - 了解如何根据规则评估 XACML 3.0 属性值
- python - Python 子进程忽略命令的输入文件
- css - 反应js不显示'
Click on <a href='https://test.com' target="_blank">https://test.com</a> 2. Select data 2.1 Filter by Database Name 2.5 Click Save
- python - 比较两个包含浮点数的火花数据帧以进行单元测试
- powershell - IE 不会从 PowerShell 脚本作为计划任务打开
- c++ - 为什么编译器并不总是优化掉局部变量?